httptest
httptest copied to clipboard
Interaction with memoise
Just a note for info (should httptest get discussions?)
I had a case with tests passing on Ubuntu and failing on macOS and Windows. I first thought the mock file was not found despite its being there but it turns out it was not there.
- Test 1 (
test_that()
) was creating a mock dir, everything ok. - Test 2 (
test_that()
in the same test file) was creating a mock dir but not all mock files because some of the requests had been memoised.
I'm not even sure what the OS problem was but in conclusion one should pay attention when capturing requests that are memoised. :sweat_smile: Maybe too niche for any doc though?
Yeah if you're caching in some other layer, that's going to affect what requests are made, and thus how you test.