Open justynafurman opened 5 years ago
Hmm, hard to tell what's going on. Could you create a minimal reproducible example (https://reprex.tidyverse.org/ or otherwise) so that I could run locally and see what you're seeing? Looks like you're pretty close to it with your code example, just need to simplify a bit and wrap it up.
@nealrichardson here it it a compressed file with minimum example and mocked api example.zip
Thanks. I'll try to take a look in the next week or two. I haven't used future
but my hunch is that the multiprocess setup is spawning new R processes, and those don't inherit the tracing/mocking from the parent process.
Out of curiosity, what is your use case for using future
in this way? And how feasible would it be to turn off the multiprocessing for the API tests?
Actually, it's easy to turn off multiprocessing in my case, so it's not a big problem, but I wanted to address this issue anyway.
I have a function that requests some data from an API using this piece of code:
where
create_request(x)
creates a string with endpoint to call e.g.https://my_api.com/endpoint1/x
. The code like that works just fine inwith_mock_api
function but, if I putplan(multiprocess)
at the beginning I get an errorIs there any way to make it work with
httptest
in parallel withfurrr
package?