Closed datawookie closed 4 years ago
Hmm, hard to say without seeing the code. My first guess when things work interactively but not in R CMD check
is that file paths are involved (since it will install into a tmp dir), but it's not obvious to me where that might be here.
The odd thing is that mainnet.infura.io/9BvO7Cvbe3p5FpinlbXv-14a098-POST.json
exists but it's looking for mainnet.infura.io-14a098-POST.json
. The payload hash is the same, so the difference is that /9BvO7Cvbe3p5FpinlbXv
URI segment is missing. Does that string mean anything to you? A user id that is set in an environment variable, maybe? If so, consider Sys.setenv("THAT_ENV_VAR", "test-user")
or something in your test suite so that it's a fixed value (or similar, if this isn't exactly the case).
Hi @nealrichardson, yes! That's precisely what the problem was. I should have realised the significance. Thanks for pointing me in the right direction. Best regards, Andrew.
Hi!
I've been writing tests for an API wrapper package and {httptest} has been a complete game changer. Thanks for your work on this.
I have run into a snag though. My tests work 100% fine in RStudio and also under Travis. The serialised results from the API calls are stored in a folder called
mainnet.infura.io
undertests/testthat
. This is the contents of that folder:But when I build a source package and then run
R CMD check
the tests fail. Here is the error message:My understanding is that {httptest} is now looking for the API results in
mainnet.infura.io-14a098-POST.json
andmainnet.infura.io-23dd28-POST.json
.I'm not sure why the names and location of these files differ under these different scenarios. I've hit my head against this for a bit and I'd really appreciate some help.
Thanks, Andrew.