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

Concrete demo of what I'm seeing #671

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

jennybc
Copy link
Member

@jennybc jennybc commented Feb 16, 2024

As per slack discussion

This test passes when executed via test_active_file() or test() in the RStudio console, but fails in the RStudio build pane or in a terminal inside RStudio. It passes via any method when run via R in a (non-RStudio) terminal.

Update: the CI test failures seem to just be snapshot related and are not what I'm seeing, which I'll copy/paste below.

Error (test-code.R:19:3): Jenny's problem [ansi]
Error: RStudio not running
Backtrace:
     ▆
  1. └─testthat::expect_snapshot(cli_code_wrapper("if (1) {true_val} else {false_val}")) at test-code.R:19:3
  2.   └─testthat:::expect_snapshot_helper(...)
  3.     └─testthat:::snapshot_accept_hint(variant, snapshotter$file)
  4.       ├─base::paste0(...)
  5.       └─cli::format_inline("* Run {.run testthat::snapshot_accept('{name}')} to accept the change.")
  6.         └─cli::cli_fmt(...) at cli/R/cli.R:120:3
  7.           └─cli:::cli__fmt(rec, collapse, strip_newline) at cli/R/cli.R:91:3
  8.             ├─base::do.call(app[[msg$type]], msg$args) at cli/R/cli.R:61:5
  9.             └─cli (local) `<fn>`(text = `<cl_gl_dl>`)
 10.               └─cli:::clii_inline_text(app, text) at cli/R/cliapp.R:6:3
 11.                 └─app$xtext(text, wrap = FALSE) at cli/R/cliapp.R:171:3
 12.                   └─cli:::clii__xtext(...) at cli/R/cliapp.R:6:3
 13.                     └─style$fmt(text) at cli/R/internals.R:18:3
 14.                       └─cli::code_highlight(lines) at cli/R/themes.R:373:5
 15.                         ├─code_theme %||% code_theme_default() at cli/R/prettycode.R:41:3
 16.                         └─cli:::code_theme_default() at cli/R/prettycode.R:41:3
 17.                           └─cli:::code_theme_default_rstudio() at cli/R/prettycode.R:243:5
 18.                             └─cli:::get_rstudio_theme() at cli/R/prettycode.R:272:3
 19.                               ├─base::suppressWarnings(rstudioapi::getThemeInfo()) at cli/R/aaa-utils.R:166:3
 20.                               │ └─base::withCallingHandlers(...)
 21.                               └─rstudioapi::getThemeInfo()
 22.                                 └─rstudioapi::callFun("getThemeInfo")
 23.                                   └─rstudioapi::verifyAvailable()

@gaborcsardi
Copy link
Member

gaborcsardi commented Feb 19, 2024

I can't reproduce this, the test passes in the build pane, and also in an RStudio terminal. :(

Can you check your config for potentially related env vars and options?

@jennybc
Copy link
Member Author

jennybc commented Feb 19, 2024

I've removed .Renviron and .Rprofile and see the same result as before (failure in the RStudio build pane). FWIW this is with RStudio Version 2023.12.1+402 (2023.12.1+402).

@gaborcsardi
Copy link
Member

Yeah, same here. Same RStudio, R 4.3.2, no profile, no env vars, no test failure.

The stack trace, otoh, looks pretty good, I might be able to work something out there.

@gaborcsardi
Copy link
Member

What's your theme?

> rstudioapi::getThemeInfo()
$editor
[1] "Chrome"

$global
[1] "Modern"

$dark
[1] FALSE

$foreground
[1] "rgb(0, 0, 0)"

$background
[1] "rgb(255, 255, 255)"

@jennybc
Copy link
Member Author

jennybc commented Feb 19, 2024

Looks same as you:

rstudioapi::getThemeInfo()
#> $editor
#> [1] "Chrome"
#> 
#> $global
#> [1] "Modern"
#> 
#> $dark
#> [1] FALSE
#> 
#> $foreground
#> [1] "rgb(0, 0, 0)"
#> 
#> $background
#> [1] "rgb(255, 255, 255)"

@gaborcsardi
Copy link
Member

What's your testthat version?

@jennybc
Copy link
Member Author

jennybc commented Feb 21, 2024

testthat 3.2.1

Freshly re-installed and re-checked, for good measure. Still seeing my same result.

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

Successfully merging this pull request may close these issues.

2 participants