-
Notifications
You must be signed in to change notification settings - Fork 318
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
Run Tests is now very verbose, showing one line per test #1561
Comments
@gaborcsardi did you know cli 3.4.0 fixes this? |
I would not think that cli fixed this, but FWIW, I do not see it with a fairly recent RStudio build. |
If I swap to cli 3.3.0 it breaks again, which is why I thought they'd be related |
I see ℹ Loading desc
══ Testing test-built.R ════════════════════════════════════════════════════════
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 0 ]
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 2 ] Done!
Test complete with cli 3.3.0 and latest stable RStudio Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.1 (2022-06-23 ucrt)
#> os Windows 10 x64 (build 19044)
#> system x86_64, mingw32
#> ui RTerm
#> language en
#> collate German_Germany.utf8
#> ctype German_Germany.utf8
#> tz Europe/Berlin
#> date 2022-09-12
#> pandoc 2.19.2 @ C:/PROGRA~1/Pandoc/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> brio 1.1.3 2021-11-30 [1] CRAN (R 4.2.0)
#> cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0)
#> evaluate 0.16 2022-08-09 [1] CRAN (R 4.2.1)
#> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0)
#> htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.1)
#> knitr 1.40 2022-08-24 [1] CRAN (R 4.2.1)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.2.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0)
#> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.1)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0)
#> R.utils 2.12.0 2022-06-28 [1] CRAN (R 4.2.1)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.1)
#> rlang 1.0.5 2022-08-31 [1] CRAN (R 4.2.1)
#> rmarkdown 2.16 2022-08-24 [1] CRAN (R 4.2.1)
#> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
#> stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1)
#> stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.1)
#> styler 1.7.0 2022-03-13 [1] CRAN (R 4.2.0)
#> testthat * 3.1.4 2022-04-26 [1] CRAN (R 4.2.0)
#> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0)
#> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0)
#> xfun 0.32 2022-08-10 [1] CRAN (R 4.2.1)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0)
#>
#> [1] C:/Users/Daniel/AppData/Local/R/win-library/4.2
#> [2] C:/Program Files/R/R-4.2.1/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
... and the same with cli 3.4.0, so the new cli version doesn't fix this for me. 🤷🏻♂️ Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.1 (2022-06-23 ucrt)
#> os Windows 10 x64 (build 19044)
#> system x86_64, mingw32
#> ui RTerm
#> language EN
#> collate German_Germany.utf8
#> ctype German_Germany.utf8
#> tz Europe/Berlin
#> date 2022-09-12
#> pandoc 2.18 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> brio 1.1.3 2021-11-30 [1] CRAN (R 4.2.0)
#> cli 3.4.0 2022-09-08 [1] CRAN (R 4.2.1)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0)
#> evaluate 0.16 2022-08-09 [1] CRAN (R 4.2.1)
#> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0)
#> htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.1)
#> knitr 1.40 2022-08-24 [1] CRAN (R 4.2.1)
#> lifecycle 1.0.2 2022-09-09 [1] CRAN (R 4.2.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0)
#> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.1)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0)
#> R.utils 2.12.0 2022-06-28 [1] CRAN (R 4.2.1)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.1)
#> rlang 1.0.5 2022-08-31 [1] CRAN (R 4.2.1)
#> rmarkdown 2.16 2022-08-24 [1] CRAN (R 4.2.1)
#> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
#> stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1)
#> stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.1)
#> styler 1.7.0 2022-03-13 [1] CRAN (R 4.2.0)
#> testthat * 3.1.4 2022-04-26 [1] CRAN (R 4.2.0)
#> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0)
#> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0)
#> xfun 0.32 2022-08-10 [1] CRAN (R 4.2.1)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0)
#>
#> [1] C:/Users/Daniel/AppData/Local/R/win-library/4.2
#> [2] C:/Program Files/R/R-4.2.1/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
Does this mean that this should/needs to be fixed in RStudio, @gaborcsardi? |
I would think so, yes. Try the latest RStudio release. |
It is possible you need a daily build https://dailies.rstudio.com/ |
Sorry, no luck. I get the same output with the latest daily (and cli 3.4.0)
|
It's not filed as an issue there, is it? |
IDK. |
This now mostly works for me. The remainder should be fixed by #1633 |
Could you please elaborate @hadley? Because it does not on my machine. I am still seeing with RStudio Desktop 2022.11.0-daily+199, Win10, testthat from #1633 (but also today's main @ 81dfbed): ==> Testing R file using 'testthat'
══ Testing test-testthat.R ═════════════════════════════════════════════════════
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 0 ]
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ]
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 2 ] Done!
Test complete Do you mean "testthat is fine, got to be fixed in rstudio/rstudio#11969"? Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.1 (2022-06-23 ucrt)
#> os Windows 10 x64 (build 19044)
#> system x86_64, mingw32
#> ui RTerm
#> language EN
#> collate German_Germany.utf8
#> ctype German_Germany.utf8
#> tz Europe/Berlin
#> date 2022-09-22
#> pandoc 2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> brio 1.1.3 2021-11-30 [1] CRAN (R 4.2.0)
#> cli 3.4.0 2022-09-08 [1] CRAN (R 4.2.1)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0)
#> evaluate 0.16 2022-08-09 [1] CRAN (R 4.2.1)
#> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0)
#> htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.1)
#> knitr 1.40 2022-08-24 [1] CRAN (R 4.2.1)
#> lifecycle 1.0.2 2022-09-09 [1] CRAN (R 4.2.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0)
#> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.1)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0)
#> R.utils 2.12.0 2022-06-28 [1] CRAN (R 4.2.1)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.1)
#> rlang 1.0.5 2022-08-31 [1] CRAN (R 4.2.1)
#> rmarkdown 2.16 2022-08-24 [1] CRAN (R 4.2.1)
#> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
#> stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1)
#> stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.1)
#> styler 1.7.0 2022-03-13 [1] CRAN (R 4.2.0)
#> testthat * 3.1.4.9000 2022-09-22 [1] Github (r-lib/testthat@a871362)
#> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0)
#> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0)
#> xfun 0.32 2022-08-10 [1] CRAN (R 4.2.1)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0)
#>
#> [1] C:/Users/Daniel/AppData/Local/R/win-library/4.2
#> [2] C:/Program Files/R/R-4.2.1/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
It works for me 😞 |
Then we'll ship your machine. 😉 |
This wasn't working for me for a bit, but it seems to be working once more. This is a bit of a mystery to me. |
@gaborcsardi is then anything we can do in cli in the interim? |
@kevinushey I've run I'm on RStudio 2023.09.1 Build 393, EDIT: Looking more closely at the |
It should be sufficient to set that in your current R environment, since that would be inherited by child processes as well... Are you able to debug more to see what
|
I see in Interestingly, I did notice a slight change in output behaviour before and after running
|
Hmm, my version of RStudio does set these environment variables, even when clicking the Run Tests button:
These are for individual test files that would normally be run via |
Sorry, correction: it is indeed reading as the Build pane. However, at this line: The RStudio PID is not matching the retrieved parent PID, hence it is treating it as |
Ah, yeah, then that's the same diagnosis as in #1561 (comment), so would require some changes in |
Ok, thanks. I thought the workaround you stated might fix it but now seems clear that Thanks for your help! |
@kevinushey I did a little bit more investigation. It seems that RStudio doesn't initialize properly some env vars that are crucial for good functioning output.
it seems that there is a problem in RStudio directly. During the test_active file I created this file to investigate which envvars are initialized. Maybe some code in the IDE could be modified to enforce the envvars are properly set. I tried to make a fix in cli, but it didn't really make sense as the important missing env vars problem is from RStudio.. The criteria used by cli is is_rstudio <- function() Sys.getenv("RSTUDIO") == "1" and returns FALSE for me in the test active file setting. In a package, I used the following for my investigation test_that("test in pane", {
print({
"\n"
Sys.getenv("RSTUDIO")
Sys.getenv("RSTUDIO_CLI_HYPERLINKS ")
Sys.getenv()
})
expect_equal(rstudio_detect()$type, "rstudio_build_pane")
}) The relevant env vars I see are the following.
I would guess that in the regular testthat (ctrl + shift + t), the 2 variables I mentioned above are present to ensure proper detection. Hope this can help resolve the issue (I opened an issue in the repo a while back. (rstudio/rstudio#13088) -- Testing the active file works as expected with hyperlinks functioning test_that("test in pane", {
withr::local_envvar(list(
"RSTUDIO" = "1",
"RSTUDIO_CLI_HYPERLINKS" = "true"
))
expect_equal(rstudio_detect()$type, "rstudio_build_pane")
expect_false(TRUE)
}) |
@olivroy if the fix for this would need to happen in RStudio, could you please file this issue on the RStudio issue repository so it doesn't get lost? |
@kevinushey already done with rstudio/rstudio#13088, which is probably a duplicate of rstudio/rstudio#11969. Now resolved on RStudio's end 2024.07 |
If i hit Run Tests on a file with testthat 3.1.2, it shows me output for every individual test in the file rather than one summary at the end. (RStudio 2021.09.2 Build 382)
Gabor:
The text was updated successfully, but these errors were encountered: