python-cachier / cachier

Persistent, stale-free, local and cross-machine caching for Python functions.
MIT License
539 stars 60 forks source link

Cannot run pickle_core tests if mongo TEST_HOST is not setup. #93

Closed louismartin closed 1 year ago

louismartin commented 1 year ago

I'm trying to run the tests for the pickle core for #90, but they fail with

KeyError: 'cachier: No configuration value for TEST_HOST.'

I think this is due to the file tests/conftest.py that is run anyway at import time and teardown and that tries to import mongo logic.

louismartin commented 1 year ago

I think the readme is also not up to date: https://github.com/shaypal5/cachier/blame/master/README.rst#L294

To run only pickle core related tests, use:
  pytest -m mongo
louismartin commented 1 year ago

Seems that it work when ignoring the conftest but it's not ideal:

pytest tests/test_pickle_core.py --noconftest 
shaypal5 commented 1 year ago

Ok. So a few things fixed so contributers like you can work:

  1. The README mistake you've mentioned is fixed.
  2. I've added - in that same section - documentation on how to use pytest syntax to run everything but MongoDB tests, etc.
  3. I've awakened our free cluster on mondodb.com. MongoDB tests now pass.
  4. I've approved all your Github Actions jobs to run, so you should see test results for your PRs.
  5. I'm adding a weekly run of the test job, so our free cluster on mondodb.com won't go to sleep again.

Cheers, man! I'll take a look at the PR itself soon.

shaypal5 commented 1 year ago

Also, note that MongoDB tests should run successfully by Github Actions for your PRs, so make sure everything else works by testing pickle and memory core tests locally, and then will make sure MongoDB functionality was not broken when you open PRs.

Thank you for contributing! <3