I'm migrating a Django project to use Tox and pytest. I'm getting the following when running tox.
_________________________________________ ERROR collecting fixtureless/tests/test_django_project/test_app/tests/test_factory.py _________________________________________
fixtureless/tests/test_django_project/test_app/tests/test_factory.py:10: in <module>
from test_app.models import ModelOne, ModelTwo
fixtureless/tests/test_django_project/test_app/models.py:11: in <module>
class ModelOne(models.Model):
.tox/py36-django21/lib/python3.6/site-packages/django/db/models/base.py:87: in __new__
app_config = apps.get_containing_app_config(module)
.tox/py36-django21/lib/python3.6/site-packages/django/apps/registry.py:249: in get_containing_app_config
self.check_apps_ready()
.tox/py36-django21/lib/python3.6/site-packages/django/apps/registry.py:132: in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
E django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Here is my tox file.
[tox]
skipsdist = true
envlist =
py{36,37}-django21,
py{36,37}-django22,
# Add environment to use the default python3 installation
[testenv]
setenv =
PYTHONDONTWRITEBYTECODE=1
PYTHONPATH = {toxinidir}:{toxinidir}/fixtureless/tests/test_django_project
DJANGO_SETTINGS_MODULE = settings.postgres
deps =
pillow
psycopg2
pytest
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
commands = pytest
It's like django.setup() isn't being invoked or something. I'm fairly new to tox still. Any help would be greatly appreciated.
This is an open source project (django-fixtureless) and I have been successfully running the Django test suite using the instructions outlined here.
Aucun commentaire:
Enregistrer un commentaire