Skip to content

Incongruity of test_local() argument, argument usage, and documentation #1883

Open
@hdhshowalter-lilly

Description

@hdhshowalter-lilly

test_local() includes the argument path, and the corresponding argument documentation states "Path to directory containing tests." This is consistent with the documentation for the path argument of test_dir(). In practice, however, test_dir() can be executed against test files located in directories other than test/testthat, but test_local cannot; https://github.com/r-lib/testthat/blob/main/R/test-package.R#L64C1-L64C1 forces the tests to live in test/testthat. I do see that this expectation is referenced in the "special files" vignette (https://github.com/r-lib/testthat/blob/main/vignettes/special-files.Rmd#L27C1-L27C13), but then I'm not sure what purpose path serves within the context of test_local().

For strategic reasons, I have a separate set of tests that I would like to store in a different directory. I can get these to run by utilizing test_dir() (or test_file(), or the internal function test_files()), but not test_local(). Thus I would personally love path to function the same way in test_local() as it does in those lower-level functions.

Tangential nice-to-have: I would also like to be able to able to give my separate test set a (common) prefix other than "test-" or "test_", but find_test_scripts() (https://github.com/r-lib/testthat/blob/main/R/test-files.R#L375) prohibits this. It would be cool if that expectation was the default, but could be optionally skipped over in favor of using the filter argument directly (e.g., to identify a collection of files that starts with some other prefix).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions