Open jayvdb opened 4 years ago
Yeah, creating required tables is a must. That's described in: https://django-siteprefs.readthedocs.io/en/latest/quickstart.html
Personally I don't bother with pytest-django and use pytest-djangoapp
instead.
I tried setting up an RPM for pytest-djangoapp a few weeks ago at https://build.opensuse.org/package/show/home:jayvdb:django/python-pytest-djangoapp , but it fails the tests with
[ 48s] + PYTHONPATH=:/home/abuild/rpmbuild/BUILDROOT/python-pytest-djangoapp-0.14.0-3.1.x86_64/usr/lib/python3.8/site-packages
[ 48s] + PYTHONDONTWRITEBYTECODE=1
[ 48s] + py.test-3.8 --ignore=_build.python2 --ignore=_build.python3 --ignore=_build.pypy3 -v
[ 49s] ============================= test session starts ==============================
[ 49s] platform linux -- Python 3.8.3, pytest-5.3.5, py-1.8.1, pluggy-0.13.1 -- /usr/bin/python3
[ 49s] cachedir: .pytest_cache
[ 49s] rootdir: /home/abuild/rpmbuild/BUILD/pytest-djangoapp-0.14.0
[ 49s] collecting ... collected 0 items / 1 error
[ 49s]
[ 49s] ==================================== ERRORS ====================================
[ 49s] ________________________ ERROR collecting test session _________________________
[ 49s] Defining 'pytest_plugins' in a non-top-level conftest is no longer supported:
[ 49s] It affects the entire test suite instead of just below the conftest as expected.
[ 49s] /home/abuild/rpmbuild/BUILD/pytest-djangoapp-0.14.0/pytest_djangoapp/tests/conftest.py
[ 49s] Please move it to a top level conftest file at the rootdir:
[ 49s] None
[ 49s] For more information, visit:
[ 49s] https://docs.pytest.org/en/latest/deprecations.html#pytest-plugins-in-non-top-level-conftest-files
[ 49s] !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
[ 49s] =============================== 1 error in 0.14s ===============================
If that has been fixed, I will retry it.
If migrations are not done first, pytest-django tries to configure django before running migrations, and fails
postgres is similar, with
psycopg2.errors.UndefinedTable: relation "siteprefs_preference" does not exist
Workaround atm is to migrate first and then use
pytest --reuse-db