Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find shiny port number #361

Closed
nick-youngblut opened this issue Oct 12, 2023 · 2 comments
Closed

Cannot find shiny port number #361

nick-youngblut opened this issue Oct 12, 2023 · 2 comments

Comments

@nick-youngblut
Copy link

nick-youngblut commented Oct 12, 2023

My shiny app and tests are setup as described in #359

The output of shinytest2::test_app('app'):

| F W S  OK | Context| 1       0 | shinytest2 [30.7s]                                                               
─────────────────────────────────────────────────────────────────────────────────────────────────
Error (test-shinytest2.R:5:3): App initialization
Error in `app_initialize(self, private, app_dir = app_dir, ..., load_timeout = load_timeout, 
    timeout = timeout, wait = wait, expect_values_screenshot_args = expect_values_screenshot_args, 
    screenshot_args = screenshot_args, check_names = check_names, 
    name = name, variant = variant, view = view, height = height, 
    width = width, seed = seed, clean_logs = clean_logs, shiny_args = shiny_args, 
    render_args = render_args, options = options)`: Cannot find shiny port number. Error lines found:You can inspect the failed AppDriver object via `rlang::last_error()$app`AppDriver logs:
{shinytest2} R info   18:18:20.78 Start AppDriver initialization
{shinytest2} R info   18:18:20.78 Starting Shiny app
{shinytest2} R info   18:18:51.25 Error while initializing AppDriver:
                                  Cannot find shiny port number. Error lines found:
{shiny}      R stdout ----------- - The project is out-of-sync -- use `renv::status()` for details.


Caused by error in `app_start_shiny()`:
! Cannot find shiny port number. Error lines found:
─────────────────────────────────────────────────────────────────────────────────────────────────

══ Results ══════════════════════════════════════════════════════════════════════════════════════
Duration: 30.9 s

── Failed tests ─────────────────────────────────────────────────────────────────────────────────
Error (test-shinytest2.R:5:3): App initialization
Error in `app_initialize(self, private, app_dir = app_dir, ..., load_timeout = load_timeout, 
    timeout = timeout, wait = wait, expect_values_screenshot_args = expect_values_screenshot_args, 
    screenshot_args = screenshot_args, check_names = check_names, 
    name = name, variant = variant, view = view, height = height, 
    width = width, seed = seed, clean_logs = clean_logs, shiny_args = shiny_args, 
    render_args = render_args, options = options)`: Cannot find shiny port number. Error lines found:You can inspect the failed AppDriver object via `rlang::last_error()$app`AppDriver logs:
{shinytest2} R info   18:18:20.78 Start AppDriver initialization
{shinytest2} R info   18:18:20.78 Starting Shiny app
{shinytest2} R info   18:18:51.25 Error while initializing AppDriver:
                                  Cannot find shiny port number. Error lines found:
{shiny}      R stdout ----------- - The project is out-of-sync -- use `renv::status()` for details.


Caused by error in `app_start_shiny()`:
! Cannot find shiny port number. Error lines found:

[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]

Don't worry, you'll get it.
Error: Test failures

sessionInfo

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] shiny_1.7.5      shinytest2_0.3.1 testthat_3.1.10 

loaded via a namespace (and not attached):
 [1] jsonlite_1.8.7      compiler_4.3.1      renv_1.0.2          crayon_1.5.2       
 [5] brio_1.1.3          promises_1.2.1      Rcpp_1.0.11         callr_3.7.3        
 [9] later_1.3.1         yaml_2.3.7          fastmap_1.1.1       mime_0.12          
[13] R6_2.5.1            htmlwidgets_1.6.2   backports_1.4.1     checkmate_2.2.0    
[17] tibble_3.2.1        desc_1.4.2          rprojroot_2.0.3     pillar_1.9.0       
[21] rlang_1.1.1         websocket_1.4.1     utf8_1.2.3          httpuv_1.6.11      
[25] fs_1.6.3            config_0.3.2        pkgload_1.3.2.1     rhandsontable_0.3.8
[29] cli_3.6.1           withr_2.5.0         magrittr_2.0.3      ps_1.7.5           
[33] digest_0.6.33       processx_3.8.2      rstudioapi_0.15.0   xtable_1.8-4       
[37] chromote_0.1.2      lifecycle_1.0.3     waldo_0.5.1         vctrs_0.6.3        
[41] glue_1.6.2          fansi_1.0.4         httr_1.4.7          tools_4.3.1        
[45] pkgconfig_2.0.3     ellipsis_0.3.2      htmltools_0.5.6  
@nick-youngblut
Copy link
Author

It appears that this is a result of including a .Rprofile file in my app directory (see #359) that includes the following:

source("../renv/activate.R")
renv::restore(lockfile="../renv.lock")

If I comment-out the lines in the ./app/.Rprofile file, then the tests pass.

So, @gadenbuie I'm not sure what to do. Including ./app/.Rprofile allows the Github Action to succeed, but then my local testing with shinytest2::test_app('app') fails.

@nick-youngblut
Copy link
Author

I'm closing this issue, since it should be fixed via #362

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant