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

Support developer tests #1988

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Support developer tests #1988

wants to merge 1 commit into from

Conversation

jeroen
Copy link
Member

@jeroen jeroen commented Sep 10, 2024

A cleaner pattern to distinguish between public tests and developer tests.

Developer tests only run in CI or devtools, and can be used for tests that are not appropriate for public infrastructure such as CRAN or other downstream use, e.g. tests that require special tooling, are flaky, or consume much resources.

@jeroen jeroen changed the title Support developer Support developer tests Sep 10, 2024
@@ -373,6 +373,10 @@ local_teardown_env <- function(frame = parent.frame()) {
#' @export
find_test_scripts <- function(path, filter = NULL, invert = FALSE, ..., full.names = TRUE, start_first = NULL) {
files <- dir(path, "^test.*\\.[rR]$", full.names = full.names)
if (env_var_is_true("CI") || env_var_is_true("NOT_CRAN")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly there is room for an explicit opt in/out env var that is very specific to this feature, like:

run_dev_tests <- function() {
  if (env_var_is_true("RUN_DEV_TESTS")) {
     return(TRUE)
  }

  if (env_var_is_false("RUN_DEV_TESTS")) {
     return(FALSE)
  }

  env_var_is_true("CI") || env_var_is_true("NOT_CRAN")
}

@jeroen
Copy link
Member Author

jeroen commented Oct 28, 2024

Thinking a bit more about this after todays dicussion about how this works for reverse dependency checks. Perhaps the dev tests should be opt-in per package. So the variable should be named e.g. JSONLITE_RUN_DEV_TESTS to opt-in to dev tests from jsonlite only.

For example, if I want to run a reverse dependency check for curl, I also may want to run the developer tests for httr and httr2 but not for all the random packages with api wrappers that require custom auth tokens and so on.

@JosiahParry
Copy link

Just chiming in to say that I would really like to see this capability added to testthat. My particular use case is that my package arcpbf is used by arcgislayers and I want arcpbf to have integration tests for GHA CI but not to actually be tested on CRAN.

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

Successfully merging this pull request may close these issues.

3 participants