You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using django-assets on a multi-framework codebase where some tests won't require django.
What will happen is this:
______ ERROR at setup of test_allowed_to_peergrade[B-expired-False-NONE] _______
../../../virtualenv/python3.7.1/lib/python3.7/site-packages/django_assets/pytest_plugin.py:6: in set_django_assets_env
django_assets.env.get_env() # initialise django-assets settings
../../../virtualenv/python3.7.1/lib/python3.7/site-packages/django_assets/env.py:177: in get_env
env = DjangoEnvironment()
../../../virtualenv/python3.7.1/lib/python3.7/site-packages/webassets/env.py:724: in __init__
self.config.setdefault('debug', False)
../../../virtualenv/python3.7.1/lib/python3.7/site-packages/webassets/env.py:63: in setdefault
if not key in self:
../../../virtualenv/python3.7.1/lib/python3.7/site-packages/django_assets/env.py:51: in __contains__
return hasattr(settings, self._transform_key(key))
../../../virtualenv/python3.7.1/lib/python3.7/site-packages/django/conf/__init__.py:57: in __getattr__
self._setup(name)
../../../virtualenv/python3.7.1/lib/python3.7/site-packages/django/conf/__init__.py:42: in _setup
% (desc, ENVIRONMENT_VARIABLE))
E django.core.exceptions.ImproperlyConfigured: Requested setting ASSETS_DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
In my case, django-assets is being pulled in with all pytest tests, since it's autouse=True and attempting to access the settings singleton.
I'm thinking about what the best option would be to handle this - I think the best option would be to hold off autouse=True and let the user add the fixture where and when they need it.
The text was updated successfully, but these errors were encountered:
tony
added a commit
to eduflow/django-assets
that referenced
this issue
Jan 7, 2019
This fixes an issue where django-assets would break non-django
pytest fixtures simply because django-assets was installed as
as package.
Fixesmiracle2k#94
Sounds good. I am wracking my brain trying to figure out what the purpose of this fixture is. It came from a PR from @tomd-aptivate a couple years ago. @tony do you know?
@miracle2k I'm not using pytest+django-assets at the same time, so I can't tell for sure, the original usage of it was to make sure django-assets didn't lose settings (apparently): 435264e#diff-2188999a0e7833c3726f2360cadccb1a / #33
I am using django-assets on a multi-framework codebase where some tests won't require django.
What will happen is this:
In my case, django-assets is being pulled in with all pytest tests, since it's
autouse=True
and attempting to access the settings singleton.I'm thinking about what the best option would be to handle this - I think the best option would be to hold off
autouse=True
and let the user add the fixture where and when they need it.The text was updated successfully, but these errors were encountered: