Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit_file / exit_if_not not working #126

Open
LiNk-NY opened this issue Nov 30, 2023 · 2 comments
Open

exit_file / exit_if_not not working #126

LiNk-NY opened this issue Nov 30, 2023 · 2 comments

Comments

@LiNk-NY
Copy link

LiNk-NY commented Nov 30, 2023

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'
@markvanderloo
Copy link
Owner

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.

@LiNk-NY
Copy link
Author

LiNk-NY commented Nov 30, 2023

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants