nealrichardson / httptest

A Test Environment for HTTP Requests in R
https://enpiar.com/r/httptest/
Other
79 stars 10 forks source link

Use absolute paths for .mockPaths() for tests using a temporary directory? #74

Open maelle opened 2 years ago

maelle commented 2 years ago

If a test sets a temporary directory like so https://github.com/maelle/setwdsetwd/blob/main/tests/testthat/test-request.R then no mock directory is set in the actual package.

If I comment out the line with withr::local_dir(tempdir) then a mock dir is created.

My real use case consists in testing a package that is used for package development, therefore most tests use throwaway packages, and most functions work on the current directory so I really need to change the working directory.

I think this problem might affect httptest2 too.

This issue reminds me of https://github.com/r-lib/testthat/issues/1359