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

testthat::skip() aborts the generation of a reprex #400

Closed
krlmlr opened this issue Oct 29, 2021 · 6 comments
Closed

testthat::skip() aborts the generation of a reprex #400

krlmlr opened this issue Oct 29, 2021 · 6 comments

Comments

@krlmlr
Copy link
Member

krlmlr commented Oct 29, 2021

I suspect it's a problem further upstream, because it occurs in rmarkdown too. Maybe in {evaluate}?

print(reprex::reprex(stop("oops")))
#> ℹ Non-interactive session, setting `html_preview = FALSE`.
#> ℹ Rendering reprex...
#> CLIPR_ALLOW has not been set, so clipr will not run interactively
#> [1] "``` r"                                                                                          
#> [2] "stop(\"oops\")"                                                                                 
#> [3] "#> Error in eval(expr, envir, enclos): oops"                                                    
#> [4] "```"                                                                                            
#> [5] ""                                                                                               
#> [6] "<sup>Created on 2021-10-29 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)</sup>"
print(reprex::reprex(testthat::skip("wat")))
#> ℹ Non-interactive session, setting `html_preview = FALSE`.
#> ℹ Rendering reprex...
#> NULL

Created on 2021-10-29 by the reprex package (v2.0.1)

If I run reprex::reprex(testthat::skip("wat")) locally, I see:

ℹ Rendering reprex...
Error in dirname(path[!is_missing]) : 
  a character vector argument expected
Backtrace:
     ▆
  1. └─reprex::reprex(testthat::skip("wat"))
  2.   └─reprex:::reprex_impl(...)
  3.     └─reprex:::reprex_render_impl(...)
  4.       └─reprex:::preview(md_file)
  5.         └─reprex:::preview_file(input)
  6.           └─reprex:::path_mutate(path, suffix = "preview", ext = "html")
  7.             └─reprex:::add_suffix(path, suffix)
  8.               └─fs::path_ext_remove(x)
  9.                 └─fs::path_dir(path)
 10.                   └─base::dirname(path[!is_missing])
@dirkschumacher
Copy link

I stumbled across the same error when my code produced a stack limit error:

> reprex::reprex({
+   stack_overflow <- \(x) stack_overflow(x + 1)
+   stack_overflow(10)
+ })
ℹ Rendering reprex...
Error in dirname(path[!is_missing]) : 
  a character vector argument expected

@jennybc
Copy link
Member

jennybc commented Nov 1, 2021

Yeah I can reproduce what @krlmlr reports without reprex, so I think this has to be pursued upstream.

@jennybc jennybc closed this as completed Nov 1, 2021
@jennybc
Copy link
Member

jennybc commented Nov 1, 2021

Maybe related to #119, r-lib/testthat#594

jennybc added a commit that referenced this issue Nov 1, 2021
@jennybc
Copy link
Member

jennybc commented Nov 1, 2021

The failure in these cases will be somewhat better, in that I now point out that something about the reprex interacts fatally with the rendering machinery.

@jennybc
Copy link
Member

jennybc commented Nov 1, 2021

@dirkschumacher your example is basically exactly #388 (C stack usage ... is too close to the limit).

@jennybc
Copy link
Member

jennybc commented Nov 2, 2021

@dirkschumacher your example is also now covered by r-lib/evaluate#103

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

3 participants