tinytest
tinytest copied to clipboard
exit_file / exit_if_not not working
Hi Mark, @markvanderloo
I hope you are well.
I am using tinytest
for a Bioconductor package: AnVILAz and I am having difficulty using exit_file()
and exit_if_not
.
They don't seem to be working properly.
I have three methods of exiting the test file using both exit_file()
and exit_if_not()
:
## method 1
AnVILAz:::.exit_if_not_anvilaz()
> dput(AnVILAz:::.exit_if_not_anvilaz)
function ()
{
if (!.is_anvil_az())
tinytest::exit_file("Not running on AnVIL Azure workspace")
}
## method 2
if (!AnVILAz:::.is_anvil_az())
tinytest::exit_file("Not running on AnVIL Azure workspace")
## method 3
tinytest::exit_if_not(
"Not running on AnVIL Azure workspace" = AnVILAz:::.is_anvil_az()
)
Despite these trips, the tests continue to run when running R CMD check
and tinytest::test_package("AnVILAz")
:
> tinytest::test_package("AnVILAz")
test_az_copy.R................ 0 tests sh: 1: az: not found
sh: 1: az: not found
Error in system2("az", c("account", "get-access-token"), stdout = TRUE) :
error in running command
In addition: Warning message:
In system2("az", c("login", "--identity", "--allow-no-subscriptions")) :
error in running command
For context, the package is meant to run on an environment with the az
command line utility installed.
> packageVersion("tinytest")
[1] '1.4.1'
Yes, this is fixed in the development version. I have to ask one or two authors to update their package on CRAN before I can upload because of some false positives there.
Thank you @markvanderloo for looking into it!
FWIW, I have tested with the development version with the same result:
> tinytest::run_test_file("inst/tinytest/test_az_copy.R")
test_az_copy.R................ 0 tests sh: 1: az: not found
sh: 1: az: not found
Error in system2("az", c("account", "get-access-token"), stdout = TRUE) :
error in running command
In addition: Warning message:
In system2("az", c("login", "--identity", "--allow-no-subscriptions")) :
error in running command
> packageVersion("tinytest")
[1] '1.4.1.1'