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

Have a test() function, similar to devtools::test() #1030

Closed
gaborcsardi opened this issue May 9, 2020 · 5 comments · Fixed by #1084
Closed

Have a test() function, similar to devtools::test() #1030

gaborcsardi opened this issue May 9, 2020 · 5 comments · Fixed by #1084
Labels
feature a feature request or enhancement

Comments

@gaborcsardi
Copy link
Member

testthat already uses pkgload for package loading, so there is not much benefit using devtools.

@hadley
Copy link
Member

hadley commented May 9, 2020

The primary advantage is that we could just call testthat::test() in CI tools.

@hadley
Copy link
Member

hadley commented Jun 16, 2020

Hmmm, the only place we actually use it is:

maybe_root_dir <- function(path) {
  tryCatch(pkgload::pkg_path(path), error = function(...) path)
}

But I think it still makes sense to add this function, since pkgload is a lightweight dependency, and this would be a useful feature.

A few notes from reading devtools::test():

  • This function wouldn't save open files or offer to creating testing infrastructure
  • Need to set envvar TESTTHAT_PKG to name of package
  • Most arguments just passed through to test_dir().
  • C collation and useFancyQuotes should be handled elsewhere in testthat
  • Should be able to mostly implement using test_package_dir()

What would we call it? Maybe test_source_package()?

@hadley hadley added the feature a feature request or enhancement label Jun 16, 2020
@gaborcsardi
Copy link
Member Author

What would we call it? Maybe test_source_package()?

test_local(), test_tree(), test_package_tree()?

There is remotes::install_local() and pak::local_*, FWIW.

@hadley
Copy link
Member

hadley commented Jun 16, 2020

test_local() sounds good to me.

@hadley
Copy link
Member

hadley commented Jun 16, 2020

If we do this, might as well review all the uses of devtools and replace with pkgload. devtools is only suggested, but it requires a lot of compilation on the mac devel build machine.

hadley added a commit that referenced this issue Jul 5, 2020
@hadley hadley mentioned this issue Jul 5, 2020
2 tasks
hadley added a commit that referenced this issue Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants