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
devtools::test() produces error "Error in save(iraceResults, file = logfile, version = 3L): (converted from warning) 'package:irace' may not be available when loading"
#2044
Open
MLopez-Ibanez opened this issue
Dec 25, 2024
· 2 comments
If I run "R CMD check" I cannot see any warning or error, but running devtools::test() or testthat::test_local(stop_on_failure = TRUE) produces the following error:
Error in `save(iraceResults, file = logfile, version = 3L)`: (converted from warning) 'package:irace' may not be available when loading
Package irace is the package that I am testing. I ran the same code outside of testthat and there is no warning or error.
Warning (test-capping.R:20:3): irace_capping_xy maxTime = 1000
'package:irace' may not be available when loading
Backtrace:
▆
1. ├─testthat::expect_warning(irace_capping_xy(maxTime = 1000), "boundMax = 80 is too large, using 5 instead") at test-capping.R:20:3
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─irace_capping_xy(maxTime = 1000)
8. └─irace::irace(scenario = scenario) at tests/testthat/helper-common.R:153:3
9. └─irace:::irace_common(scenario, simple = TRUE) at git/R/irace.R:598:10
10. └─irace:::irace_run(scenario = scenario) at git/R/irace.R:617:3
11. └─irace:::elitist_race(...) at git/R/irace.R:1149:5
12. └─irace:::race_wrapper(...) at git/R/race.R:961:5
13. └─race_state$update_race_experiment_log(target_output, scenario) at git/R/race.R:125:3
14. └─irace:::save_irace_logfile(iraceResults, logfile = scenario$logFile) at git/R/race_state.R:118:8
15. └─base::save(iraceResults, file = logfile, version = 3L) at git/R/utils.R:503:3
Error (test-capping.R:20:3): irace_capping_xy maxTime = 1000
Error in `save(iraceResults, file = logfile, version = 3L)`: (converted from warning) 'package:irace' may not be available when loading
Backtrace:
▆
1. ├─testthat::expect_warning(irace_capping_xy(maxTime = 1000), "boundMax = 80 is too large, using 5 instead") at test-capping.R:20:3
2. │ └─testthat:::expect_condition_matching(...)
3. │ └─testthat:::quasi_capture(...)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─base::withCallingHandlers(...)
6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
7. └─irace_capping_xy(maxTime = 1000)
8. └─irace::irace(scenario = scenario) at tests/testthat/helper-common.R:153:3
9. └─irace:::irace_common(scenario, simple = TRUE) at git/R/irace.R:598:10
10. └─irace:::irace_run(scenario = scenario) at git/R/irace.R:617:3
11. └─irace:::save_irace_logfile(iraceResults, logfile = scenario$logFile) at git/R/irace.R:893:5
The text was updated successfully, but these errors were encountered:
iraceResults stores a function defined in tests/testthat/helper-common.R. For some reason, this function's environment is <environment: package:irace>. If I modify its environment as follows:
But it breaks parallel execution within R CMD check. Another strange thing I noticed. When running under R CMD check, the environment of target_runner_capping_xy is <environment: namespace:irace>. When running under devtools::test() it is <environment: package:irace>.
If I run "R CMD check" I cannot see any warning or error, but running
devtools::test()
ortestthat::test_local(stop_on_failure = TRUE)
produces the following error:Package
irace
is the package that I am testing. I ran the same code outside oftestthat
and there is no warning or error.The text was updated successfully, but these errors were encountered: