httptest icon indicating copy to clipboard operation
httptest copied to clipboard

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

Open maelle opened this issue 2 years ago • 0 comments

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

maelle avatar Aug 25 '22 14:08 maelle