You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to locate an external file with .yml extension for creating unit test with testthat while building a R package, the file is placed under \inst folder, as mentioned here https://r-pkgs.org/data.html#data-extdata. Am using system.file() to load the file with yaml package for some unit test (not base::system.file(), so that pkgload:::shim_system.file() can intercept). The tests passes if I do devtools::test(), but it keeps throwing error when I run devtools::check().
However, interestingly after lots of trials I found out that devtools::check() does not throw any error if I save the file with .txt extension instead of .yaml/.yml.
## inside test_that()
## cf <- system.file("config", "config1.yml", package = "mypackage", mustWork = TRUE)
## Error note after devtools::check()
Error in `system.file("config", "config1.yml", package = "mypackage", mustWork = TRUE)`: no file found
Backtrace:
x
1. \-base::system.file(...) test-set_config.R:34:2
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 15 ]
# -------------------------------------------------------------
## No error in devtools::check() when config1.yml is renamed as config1.txt !!
Am using latest version of devtools as on CRAN (v2.4.2), on R 4.1.1