[Python-modules-team] Bug#859916: Fails on simple test from documentation

Guido Günther agx at sigxcpu.org
Sun Apr 9 16:47:09 UTC 2017


Hi Sebastian,
On Sun, Apr 09, 2017 at 12:09:37PM +0200, Sebastian Ramacher wrote:
> Control: reassign -1 python-django-assets 0.12-1
> 
> On 2017-04-09 11:59:10, Guido Günther wrote:
> > Package: python-pytest
> > Version: 3.0.6-1
> > Severity: grave
> > 
> > (this only affects python-pytest, python-pytest3 is fine):
> > 
> > The simple test from the documentation
> > 
> >     https://docs.pytest.org/en/latest/getting-started.html#installation
> > 
> > cat <<EOF > test_sample.py
> > def func(x):
> >     return x + 1
> > 
> > def test_answer():
> >     assert func(3) == 5
> > EOF
> > 
> > fails to load at all:
> > 
> > $ pytest 
> > =============================================================================================== test session starts ===============================================================================================
> > platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
> > rootdir: /tmp/a, inifile: 
> > plugins: django-assets-0.12
> 
> This is your problem. Maybe it shouldn't auto load if there is no valid django
> configuration. Reassigning to python-django-assets.
> 
> You can disable it with pytest -p no:django-assets

Thanks for the quick respone and thanks for reassigning to the plugin
that breaks pytest!
Cheers
 -- Guido

> 
> Cheers
> 
> > collected 1 items 
> > 
> > test_sample.py E
> > 
> > ===================================================================================================== ERRORS ======================================================================================================
> > __________________________________________________________________________________________ ERROR at setup of test_answer __________________________________________________________________________________________
> > 
> >     @pytest.fixture(autouse=True)
> >     def set_django_assets_env():
> > >       django_assets.env.get_env() # initialise django-assets settings
> > 
> > /usr/lib/python2.7/dist-packages/django_assets/pytest_plugin.py:6: 
> > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> > /usr/lib/python2.7/dist-packages/django_assets/env.py:177: in get_env
> >     env = DjangoEnvironment()
> > /usr/lib/python2.7/dist-packages/webassets/env.py:701: in __init__
> >     self.config.setdefault('debug', False)
> > /usr/lib/python2.7/dist-packages/webassets/env.py:64: in setdefault
> >     self.__setitem__(key, value)
> > /usr/lib/python2.7/dist-packages/django_assets/env.py:65: in __setitem__
> >     setattr(settings, self._transform_key(key), value)
> > /usr/lib/python2.7/dist-packages/django/utils/functional.py:264: in __setattr__
> >     self._setup()
> > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> > 
> > self = <LazySettings [Unevaluated]>, name = None
> > 
> >     def _setup(self, name=None):
> >         """
> >             Load the settings module pointed to by the environment variable. This
> >             is used the first time we need any settings at all, if the user has not
> >             previously configured the settings manually.
> >             """
> >         settings_module = os.environ.get(ENVIRONMENT_VARIABLE)
> >         if not settings_module:
> >             desc = ("setting %s" % name) if name else "settings"
> >             raise ImproperlyConfigured(
> >                 "Requested %s, but settings are not configured. "
> >                 "You must either define the environment variable %s "
> >                 "or call settings.configure() before accessing settings."
> > >               % (desc, ENVIRONMENT_VARIABLE))
> > E           ImproperlyConfigured: Requested settings, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
> > 
> > /usr/lib/python2.7/dist-packages/django/conf/__init__.py:39: ImproperlyConfigured
> > ============================================================================================= 1 error in 0.05 seconds =============================================================================================
> > 
> > 
> > 
> > -- System Information:
> > Debian Release: 9.0
> >   APT prefers testing
> >   APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-updates'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
> > Architecture: amd64 (x86_64)
> > Foreign Architectures: i386
> > 
> > Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
> > Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
> > Shell: /bin/sh linked to /bin/dash
> > Init: systemd (via /run/systemd/system)
> > 
> > Versions of packages python-pytest depends on:
> > ii  python-pkg-resources  33.1.1-1
> > ii  python-py             1.4.32-3
> > pn  python:any            <none>
> > 
> > python-pytest recommends no packages.
> > 
> > Versions of packages python-pytest suggests:
> > ii  python-mock  2.0.0-3
> > 
> > -- no debconf information
> > 
> 
> -- 
> Sebastian Ramacher



More information about the Python-modules-team mailing list