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

Default .mockPaths() prefers to be in tests/testthat #52

Merged
merged 3 commits into from Dec 11, 2020

Conversation

nealrichardson
Copy link
Owner

Fixes #50

I went with a narrower solution than we discussed on #50: only the default path uses test_path(). This should support the use cases of:

devtools::load_all()
use_mock_api()
# ... do interactive testing

and

devtools::load_all()
start_capturing()
# ... do interactive requests

but doesn't otherwise add complexity in trying to guess whether a path should be relative to the current working directory, or to tests/testthat, or to vignettes, or if it should be absolute.

@maelle what do you think?

@nealrichardson
Copy link
Owner Author

Looks like that doesn't work (check fails running the examples because testthat::test_path errors if the test dir doesn't exist) so we may need a modified version.

@codecov-io
Copy link

codecov-io commented Nov 24, 2020

Codecov Report

Merging #52 (1d2d53b) into master (be6d80f) will decrease coverage by 0.22%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #52      +/-   ##
===========================================
- Coverage   100.00%   99.77%   -0.23%     
===========================================
  Files           17       17              
  Lines          445      447       +2     
===========================================
+ Hits           445      446       +1     
- Misses           0        1       +1     
Impacted Files Coverage Δ
R/mock-paths.R 94.11% <66.66%> (-5.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be6d80f...1d2d53b. Read the comment docs.

@maelle
Copy link
Contributor

maelle commented Nov 25, 2020

Thanks, I think it will make debugging easier! 🙏

@nealrichardson nealrichardson mentioned this pull request Nov 25, 2020
18 tasks
@nealrichardson nealrichardson changed the title Default .mockPaths() uses testthat::test_path() Default .mockPaths() prefers to be in tests/testthat Dec 11, 2020
@nealrichardson nealrichardson merged commit 41c89dd into master Dec 11, 2020
@nealrichardson nealrichardson deleted the interactive-mock-paths-default branch December 11, 2020 22:46
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.

Should .mockPaths() return different paths from tests/testthat and from the root of the folder
3 participants