Parallel testing subdirs throws error (`test_subdir`, `test_integration`, ...)
markschat opened this issue · 4 comments
I can´t use parallel testing (introduced by testthat 3) with testthis when testing subdirs.
E.g. testing dir /testthat/integration_tests
with test_integration()
within my R-Package throws this error (see reprex at the end):
Starting 2 test processes
✓ | F W S OK | Context
⠸ [ FAIL 0 | WARN 0 | SKIP 0 | PASS 0 ] Starting up...
Error: testthat subprocess failed to start, stderr:
...
Error in getNamespace(ns) : attempt to use zero-length variable name
Calls: callr_startup_hook ... get_env_retired -> is_environment -> asNamespace -> getNamespace
This problem is already discussed in testthat #1216 with the conclusion that the package
argument should be specified in testthat::test_dir
which is called by testthis::test_subdir
under the hood.
As far as I see, this solution don´t works here as package
will not be passed on to testthat.
Reprex
Add this lines to DESCRIPTION
to enable parallel testing (>= testthat 3) which should be enough to reproduce the error.
Config/testthat/edition: 3
Config/testthat/parallel: true
I can now confirm that providing the package
argument to testthis::test_dir
solves the problem.
I copied the call to testthat from testthis::test_subdir
and added the argument which runs without any errors.
testthat::test_dir(
file.path(usethis::proj_get(), testthat::test_path(), "integration_tests"),
package = "pkg_name"
)
Thanks! I'll look into it asap.
So this is fixed now... Is it vital to deploy this to CRAN soon? I probably have to fix #19 as well before submitting a new CRAN release as well.
Awesome! 🎉
For now I use a workaround, so releasing to CRAN is not critical for me right now.