Skip to content

Running tox without recreating causes collection error #372

@nedbat

Description

@nedbat

Trying to run the edx-cookiecutter tests locally:

% tox
py38 installed: accessible-pygments==0.0.4,alabaster==0.7.13,appdirs==1.4.4,arrow==1.2.3,asgiref==3.7.2,astroid==2.15.6,Babel==2.12.1,beautifulsoup4==4.12.2,binaryornot==0.4.4,bleach==6.0.0,build==0.10.0,certifi==2023.7.22,cffi==1.15.1,chardet==5.1.0,charset-normalizer==3.2.0,click==8.1.6,click-log==0.4.0,code-annotations==1.5.0,cookiecutter==2.2.3,coreapi==2.3.3,coreschema==0.0.4,coverage==7.2.7,cryptography==41.0.3,defusedxml==0.7.1,dill==0.3.7,distlib==0.3.7,Django==3.2.20,django-appconf==1.0.5,django-cors-headers==4.2.0,django-crum==0.7.9,django-dynamic-fixture==3.1.2,django-extensions==3.2.3,django-model-utils==4.3.1,django-rest-swagger==2.2.0,django-statici18n==2.4.0,django-waffle==4.0.0,djangorestframework==3.14.0,doc8==0.11.2,docutils==0.18.1,drf-jwt==1.19.2,edx-auth-backends==4.2.0,-e git+ssh://git@github.com/edx/edx-cookiecutters.git@a70363c0d44a79d2dc6cd11a1650f6f571187c89#egg=edx_cookiecutter_lib&subdirectory=lib,edx-django-release-util==1.3.0,edx-django-utils==5.6.0,edx-drf-extensions==8.8.0,edx-i18n-tools==1.1.0,edx-lint==5.3.4,edx-opaque-keys==2.3.0,edx-rest-api-client==5.6.0,exceptiongroup==1.1.2,filelock==3.12.2,fs==2.4.16,idna==3.4,imagesize==1.4.1,importlib-metadata==6.8.0,importlib-resources==6.0.0,iniconfig==2.0.0,isort==5.12.0,itypes==1.2.0,jaraco.classes==3.3.0,jeepney==0.8.0,Jinja2==3.1.2,keyring==24.2.0,lazy-object-proxy==1.9.0,lxml==4.9.3,Mako==1.2.4,markdown-it-py==3.0.0,MarkupSafe==2.1.3,mccabe==0.7.0,mdurl==0.1.2,more-itertools==9.1.0,mysqlclient==2.2.0,newrelic==8.9.0,oauthlib==3.2.2,openapi-codec==1.3.2,packaging==23.1,path==16.7.1,pbr==5.11.1,pip-tools==7.2.0,pkginfo==1.9.6,platformdirs==3.10.0,pluggy==1.2.0,polib==1.2.0,psutil==5.9.5,py==1.11.0,pycodestyle==2.10.0,pycparser==2.21,pydata-sphinx-theme==0.13.3,pydocstyle==6.3.0,Pygments==2.15.1,PyJWT==2.8.0,pylint==2.17.5,pylint-celery==0.3,pylint-django==2.5.3,pylint-plugin-utils==0.8.2,pymongo==3.13.0,PyNaCl==1.5.0,pyproject_hooks==1.0.0,pytest==7.4.0,pytest-cookies==0.7.0,pytest-cov==4.1.0,pytest-django==4.5.2,python-dateutil==2.8.2,python-slugify==8.0.1,python3-openid==3.2.0,pytz==2023.3,PyYAML==6.0.1,readme-renderer==40.0,requests==2.31.0,requests-oauthlib==1.3.1,requests-toolbelt==1.0.0,restructuredtext-lint==1.4.0,rfc3986==2.0.0,rich==13.4.2,SecretStorage==3.3.3,semantic-version==2.10.0,sh==2.0.4,simplejson==3.19.1,six==1.16.0,slumber==0.7.1,snowballstemmer==2.2.0,social-auth-app-django==5.2.0,social-auth-core==4.4.2,soupsieve==2.4.1,Sphinx==6.2.1,sphinx-book-theme==1.0.1,sphinx-rtd-theme==1.2.2,sphinxcontrib-applehelp==1.0.4,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==2.0.1,sphinxcontrib-jquery==4.1,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.5,sqlparse==0.4.4,stevedore==5.1.0,text-unidecode==1.3,tomli==2.0.1,tomlkit==0.12.1,tox==3.28.0,twine==4.0.2,typing_extensions==4.7.1,uritemplate==4.1.1,urllib3==2.0.4,virtualenv==20.24.2,web-fragments==2.1.0,webencodings==0.5.1,WebOb==1.8.7,wrapt==1.15.0,XBlock==1.7.0,xblock-utils==3.3.0,zipp==3.16.1
py38 run-test-pre: PYTHONHASHSEED='4160413870'
py38 run-test: commands[0] | pytest
===================================================================== test session starts =====================================================================
platform darwin -- Python 3.8.17, pytest-7.4.0, pluggy-1.2.0
cachedir: .tox/py38/.pytest_cache
rootdir: /System/Volumes/Data/root/src/edx/src/edx-cookiecutters
configfile: tox.ini
plugins: cookies-0.7.0, cov-4.1.0, django-4.5.2
collected 0 items / 1 error

=========================================================================== ERRORS ============================================================================
________________________________________________________________ ERROR collecting test session ________________________________________________________________
.tox/py38/lib/python3.8/site-packages/django_dynamic_fixture/global_settings.py:61: in get_data_fixture
    if hasattr(settings, 'DDF_DEFAULT_DATA_FIXTURE'):
.tox/py38/lib/python3.8/site-packages/django/conf/__init__.py:82: in __getattr__
    self._setup(name)
.tox/py38/lib/python3.8/site-packages/django/conf/__init__.py:63: in _setup
    raise ImproperlyConfigured(
E   django.core.exceptions.ImproperlyConfigured: Requested setting DDF_DEFAULT_DATA_FIXTURE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

During handling of the above exception, another exception occurred:
.tox/py38/lib/python3.8/site-packages/_pytest/config/__init__.py:642: in _importconftest
    mod = import_path(conftestpath, mode=importmode, root=rootpath)
.tox/py38/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/local/pyenv/pyenv/versions/3.8.17/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:961: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:843: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
.tox/py38/lib/python3.8/site-packages/django_dynamic_fixture/__init__.py:17: in <module>
    from django_dynamic_fixture.global_settings import DDF_DEFAULT_DATA_FIXTURE, DDF_FILL_NULLABLE_FIELDS, DDF_FK_MIN_DEPTH, \
.tox/py38/lib/python3.8/site-packages/django_dynamic_fixture/global_settings.py:76: in <module>
    DDF_DEFAULT_DATA_FIXTURE = get_data_fixture(default='sequential')
.tox/py38/lib/python3.8/site-packages/django_dynamic_fixture/global_settings.py:73: in get_data_fixture
    six.reraise(DDFImproperlyConfigured, DDFImproperlyConfigured("DDF_DEFAULT_DATA_FIXTURE (%s) must be 'sequential', 'static_sequential', 'global_sequential', 'random' or 'path.to.CustomDataFixtureClass'." % settings.DDF_DEFAULT_DATA_FIXTURE), sys.exc_info()[2])
.tox/py38/lib/python3.8/site-packages/django/conf/__init__.py:82: in __getattr__
    self._setup(name)
.tox/py38/lib/python3.8/site-packages/django/conf/__init__.py:63: in _setup
    raise ImproperlyConfigured(
E   django.core.exceptions.ImproperlyConfigured: Requested setting DDF_DEFAULT_DATA_FIXTURE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
=================================================================== short test summary info ===================================================================
ERROR  - django.core.exceptions.ImproperlyConfigured: Requested setting DDF_DEFAULT_DATA_FIXTURE, but settings are not configured. You must either define the envir...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================== 1 error in 3.71s =======================================================================
ERROR: InvocationError for command /System/Volumes/Data/root/src/edx/src/edx-cookiecutters/.tox/py38/bin/pytest (exited with code 2)
___________________________________________________________________________ summary ___________________________________________________________________________
ERROR:   py38: commands failed

tox -r to recreate the environment works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions