-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive dependency involving fixture 'celery_config' if Flask-CeleryExt is not installed #22
Comments
In the setup.py I see that If we don't want to require it, maybe better to mock it and provide a stub instead of changing the method?
|
Where would you put this code? |
This is the "cleanest" I could get so far :'( def _celery_config():
default_config = dict(
CELERY_ALWAYS_EAGER=True,
CELERY_CACHE_BACKEND='memory',
CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
CELERY_RESULT_BACKEND='cache',)
try:
pkg_resources.get_distribution('flask-celeryext')
def inner(celery_config):
celery_config.update(default_config)
return celery_config
except pkg_resources.DistributionNotFound:
def inner():
return default_config
return inner
celery_config = pytest.fixture(
scope='module', name='celery_config')(_celery_config()) |
* Fixes recursive error on `def celery_config(celery_config)` when celery is not installed as the fixture is not yet defined. (closes inveniosoftware#22)
* Fixes recursive error on `def celery_config(celery_config)` when celery is not installed as the fixture is not yet defined. (closes #22)
Disclaimer: I might be the source of this issue fc7ee03#diff-2eeaed663bd0d25b7e608891384b7298L47
When Flask-CeleryExt is not installed by the module where
pytest-invenio
is used, this error appears:This happens basically because
celery_config
fixture doesn't exists and therefore references itself here.One solution might be to add back
flask-celeryext
to the requirements, not only the test requirements, but this would make modules, which don't need celery, install it for the tests.From the top of my head I can't find an elegant solution, perhaps someone better versed on pytest might know something I don't. All I could come up is something along this lines:
The text was updated successfully, but these errors were encountered: