nealrichardson / httptest

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

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

Closed nealrichardson closed 3 years ago

nealrichardson commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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%) :arrow_down:

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 commented 3 years ago

Thanks, I think it will make debugging easier! :pray: