krassowski / easy-entrez

Retrieve PubMed articles, text-mining annotations, or molecular data from >35 Entrez databases via easy to use Python package - built on top of Entrez E-utilities API.
https://easy-entrez.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
68 stars 6 forks source link

Suggestion: `pytest-vcr` for reliable testing #34

Open jamesbraza opened 11 months ago

jamesbraza commented 11 months ago

I believe the test suite is actually making requests to Entrez each time it's run.

To fix this, I suggest using pytest-vcr, a pytest plug-in for caching the response of requests in a subfolder of the test folder.

It's very easy to use, and may help with the seeming flakiness of CI at the moment

krassowski commented 11 months ago

This is a good idea, though it would be best if one of the jobs was not cached (while the other were). Also, requests-cache may be preferable as it is a bit more established.

jamesbraza commented 11 months ago

Oh wow, requests-cache is a TIL for me, thanks!

And yeah, it's up to you, was just a suggestion as I noticed CI is somewhat flaky.

Maybe instead of caching for all but one job, it'd be more preferable to set up a weekly CI job using schedule that updates the cached responses.