run_tests(), called by validate_tests(), calls
stopifnot(requireNamespace(pkg)), where pkg is the package being
validated. It does this outside of the callr::r() context, which
leads to packages being loaded into the current session.
sessionInfo() then gets confused because it sees packages returned by
loadNamespaces() that are not in the search paths returned by
search().
Avoid touching the namespace by moving the stopifnot() check into the
callr::r() block (which by default propagates errors to the outer
session).
Fixes #2.
Here's a repeated test run of the full suite, as well as a few interspersed runs of the sys-info tests, within the same session:
run_tests(), called by validate_tests(), calls stopifnot(requireNamespace(pkg)), where pkg is the package being validated. It does this outside of the callr::r() context, which leads to packages being loaded into the current session. sessionInfo() then gets confused because it sees packages returned by loadNamespaces() that are not in the search paths returned by search().
Avoid touching the namespace by moving the stopifnot() check into the callr::r() block (which by default propagates errors to the outer session).
Fixes #2.
Here's a repeated test run of the full suite, as well as a few interspersed runs of the sys-info tests, within the same session:
output
``` ℹ Loading mrgvalprep ℹ Testing mrgvalprep ✔ | F W S OK | Context ✔ | 13 | get-sys-info [0.1s] ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ Duration: 0.2 s [ FAIL 0 | WARN 0 | SKIP 0 | PASS 13 ] ℹ Loading mrgvalprep ℹ Testing mrgvalprep ✔ | F W S OK | Context ✔ | 22 | end-to-end [35.4s] ✔ | 13 | get-sys-info ✔ | 2 | Optionally test hitting GHE [0.8s] ✔ | 20 | parse-github-issues [0.9s] ✔ | 35 | parse-test-output [0.4s] ✔ | 25 | read-spec-gsheet [0.8s] ✔ | 12 | Unit tests for validate-tests.R [80.4s] ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ Duration: 118.8 s [ FAIL 0 | WARN 0 | SKIP 0 | PASS 129 ] ℹ Loading mrgvalprep ℹ Testing mrgvalprep ✔ | F W S OK | Context ✔ | 13 | get-sys-info ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ [ FAIL 0 | WARN 0 | SKIP 0 | PASS 13 ] ℹ Loading mrgvalprep ℹ Testing mrgvalprep ✔ | F W S OK | Context ✔ | 22 | end-to-end [26.4s] ✔ | 13 | get-sys-info ✔ | 2 | Optionally test hitting GHE [1.0s] ✔ | 20 | parse-github-issues [0.9s] ✔ | 35 | parse-test-output [0.3s] ✔ | 25 | read-spec-gsheet [0.8s] ✔ | 12 | Unit tests for validate-tests.R [74.0s] ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ Duration: 103.3 s [ FAIL 0 | WARN 0 | SKIP 0 | PASS 129 ] ℹ Loading mrgvalprep ℹ Testing mrgvalprep ✔ | F W S OK | Context ✔ | 13 | get-sys-info ══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ [ FAIL 0 | WARN 0 | SKIP 0 | PASS 13 ] ```If I run that without the
run_tests
change here, I see plenty of failures like the ones mentioned in gh-2: