pytest-dev / pytest-django

A Django plugin for pytest.
https://pytest-django.readthedocs.io/
Other
1.39k stars 343 forks source link

Test suite fails using pytest-django 4.4 and pytest 6.2.4 #943

Closed Apteryks closed 12 months ago

Apteryks commented 3 years ago

The package on GNU Guix previously built successfully using:

dependencies: python-django@3.2.5 python-pytest-xdist@2.1.0 python-pytest@6.1.2
+ python-setuptools-scm@3.4.3

But after updating just pytest to 6.2.4, there are already these failures:

=========================== short test summary info ============================
SKIPPED [1] tests/test_django_configurations.py:7: could not import 'configurations': No module named 'configurations'
SKIPPED [1] tests/test_db_setup.py:456: Django 1.9 requires migration and has no concept of initial data fixtures
FAILED tests/test_db_access_in_repr.py::test_db_access_with_repr_in_report - ...
FAILED tests/test_db_setup.py::TestNativeMigrations::test_no_migrations - Fai...
FAILED tests/test_fixtures.py::test_custom_user_model[email] - Failed: nomatc...
FAILED tests/test_fixtures.py::test_custom_user_model[identifier] - Failed: n...
FAILED tests/test_initialization.py::test_django_setup_order_and_uniqueness
FAILED tests/test_unittest.py::test_sole_test - Failed: nomatch: '*::test_foo...
FAILED tests/test_unittest.py::TestUnittestMethods::test_setUpClass_leaf_but_not_in_dunder_dict
FAILED tests/test_unittest.py::test_debug_not_used - Failed: nomatch: '*= 1 p...
= 8 failed, 159 passed, 2 skipped, 7 deselected, 5 warnings in 62.06s (0:01:02) =

See: python-pytest-django-3.10.0-with-pytest-6.2.4.drv.txt

Updating pytest-xdist to latest 2.3.0 produces the same results as above.

So let's next update pytest-django itself to 4.4; it worsens to:

=========================== short test summary info ============================
SKIPPED [1] tests/test_django_configurations.py:7: could not import 'configurations': No module named 'configurations'
FAILED tests/test_database.py::TestDatabaseFixtures::test_django_db_reset_sequences_fixture
FAILED tests/test_fixtures.py::test_django_assert_num_queries_output_info - F...
FAILED tests/test_database.py::test_unittest_interaction - Failed: nomatch: '...
FAILED tests/test_database.py::Test_database_blocking::test_db_access_in_conftest
FAILED tests/test_database.py::Test_database_blocking::test_db_access_in_test_module
FAILED tests/test_db_access_in_repr.py::test_db_access_with_repr_in_report - ...
FAILED tests/test_db_setup.py::test_db_reuse_simple - assert <ExitCode.TESTS_...
FAILED tests/test_db_setup.py::test_db_order - assert <ExitCode.TESTS_FAILED:...
FAILED tests/test_db_setup.py::test_db_reuse - assert <ExitCode.TESTS_FAILED:...
FAILED tests/test_db_setup.py::TestSqlite::test_sqlite_test_name_used - asser...
FAILED tests/test_db_setup.py::test_xdist_with_reuse - assert <ExitCode.TESTS...
FAILED tests/test_db_setup.py::TestSqliteWithXdist::test_sqlite_in_memory_used
FAILED tests/test_db_setup.py::TestSqliteWithMultipleDbsAndXdist::test_sqlite_database_renamed
FAILED tests/test_db_setup.py::TestSqliteWithTox::test_db_with_tox_suffix - a...
FAILED tests/test_db_setup.py::TestSqliteWithTox::test_db_with_empty_tox_suffix
FAILED tests/test_db_setup.py::TestSqliteWithToxAndXdist::test_db_with_tox_suffix
FAILED tests/test_db_setup.py::TestSqliteInMemoryWithXdist::test_sqlite_in_memory_used
FAILED tests/test_db_setup.py::TestNativeMigrations::test_no_migrations - ass...
FAILED tests/test_db_setup.py::TestNativeMigrations::test_migrations_run - as...
FAILED tests/test_environment.py::TestrunnerVerbosity::test_default - Failed:...
FAILED tests/test_environment.py::TestrunnerVerbosity::test_vq_verbosity_0 - ...
FAILED tests/test_environment.py::TestrunnerVerbosity::test_verbose_with_v - ...
FAILED tests/test_environment.py::TestrunnerVerbosity::test_more_verbose_with_vv
FAILED tests/test_environment.py::TestrunnerVerbosity::test_more_verbose_with_vv_and_reusedb
FAILED tests/test_fixtures.py::test_django_assert_num_queries_output - Failed...
FAILED tests/test_fixtures.py::test_django_assert_num_queries_output_verbose
FAILED tests/test_fixtures.py::TestLiveServer::test_serve_static_with_staticfiles_app
FAILED tests/test_fixtures.py::test_custom_user_model[email] - Failed: nomatc...
FAILED tests/test_fixtures.py::test_custom_user_model[identifier] - Failed: n...
FAILED tests/test_unittest.py::test_sole_test - Failed: nomatch: '*::test_foo...
FAILED tests/test_unittest.py::TestUnittestMethods::test_django - Failed: nom...
FAILED tests/test_unittest.py::TestUnittestMethods::test_setUpClass_not_being_a_classmethod
FAILED tests/test_unittest.py::TestUnittestMethods::test_setUpClass_multiple_subclasses
FAILED tests/test_unittest.py::TestUnittestMethods::test_setUpClass_mixin - F...
FAILED tests/test_unittest.py::TestUnittestMethods::test_setUpClass_skip - Fa...
FAILED tests/test_unittest.py::TestUnittestMethods::test_multi_inheritance_setUpClass
FAILED tests/test_unittest.py::TestUnittestMethods::test_setUpClass_leaf_but_not_in_dunder_dict
FAILED tests/test_unittest.py::test_pdb_enabled - assert <ExitCode.INTERRUPTE...
FAILED tests/test_unittest.py::test_debug_not_used - Failed: nomatch: '*= 1 p...
===== 39 failed, 146 passed, 1 skipped, 7 deselected, 1 warning in 49.07s ======

See: python-pytest-django-4.4.0.drv.txt

Updating Django itself to latest, at 3.2.6 doesn't change the above result.

So we're now with these dependencies:

dependencies: python-django@3.2.6 python-pytest-xdist@2.3.0 python-pytest@6.2.4
+ python-setuptools-scm@3.4.3

The complete transitive dependencies in use are:

python-pytest-django@4.4.0 depends on the following 211 packages: python-docutils@0.16 python-cython@0.29.22 cunit@2.1-3 gfortran@7.5.0 openblas@0.3.9 python-numpy@1.17.3 libxi@1.7.10 glu@9.0.1 glslang@10-11.0.0 python-mako@1.1.3 elfutils@0.182 libva-without-mesa@2.10.0 libxrandr@1.5.2 libxv@1.0.11 libxvmc@1.0.12 python2@2.7.17 llvm@11.0.0 doxygen@1.8.17 tcsh@6.22.02 boost@1.72.0 guile@3.0.2 pcre@8.44 swig@4.0.1 gts@0.7.6 gd@2.3.0 bash-minimal@5.0.16 libgc@8.0.4 gmp@6.2.0 guile@2.0.14 fribidi@1.0.9 gs-fonts@8.11 autoconf@2.69 libtool@2.4.6 jbig2dec@0.18 autoconf-wrapper@2.69 automake@1.16.2 libpaper@1.1.24 ghostscript@9.52 libspectre@0.2.8 bison@3.5.3 help2man@1.47.13 bison@3.5.3 m4@1.4.18 flex@2.6.4 gobject-introspection@1.62.0 cairo@1.16.0 poppler@0.86.1 pixman@0.38.4 cairo@1.16.0 glib@2.62.6 python-pytest-runner@5.2 python-fonttools@4.6.0 graphite2@1.3.13 icu4c@66.1 harfbuzz@2.6.4 pango@1.44.7 libltdl@2.4.6 libxmu@1.1.3 libxpm@3.5.13 libice@1.0.10 libsm@1.2.3 libxt@1.2.0 libxaw@1.0.13 graphviz@2.42.3 xmlto@0.0.28 docbook-xml@4.5 docbook-xsl@1.79.1 wayland@1.18.0 wayland-protocols@1.20 which@2.21 kmod@27 pciutils@3.7.0 libpciaccess@0.16 libdrm@2.4.103 meson-for-build@0.53.2 ninja@1.10.0 libvdpau@1.4 libxdamage@1.1.5 libxfixes@5.0.3 libxshmfence@1.3 libxxf86vm@1.1.4 mesa@20.2.4 freeglut@3.2.1 giflib@5.2.1 libwebp@1.1.0 cmake-minimal@3.16.5 lcms@2.9 cmake-bootstrap@3.16.5 texinfo@6.7 nasm@2.14.02 libjpeg-turbo@2.0.5 libtiff@4.1.0 openjpeg@2.3.1 python-olefile@0.46 python-pillow@8.1.1 libyaml@0.2.5 python-pyyaml@5.4.1 python-tblib@1.6.0 python-coverage@5.2.1 python-async-generator@1.10 python-pytest-asyncio@0.10.0 python-asgiref@3.3.4 python-pytz@2021.1 python-sqlparse@0.4.1 argon2@20190702 python-argon2-cffi@20.1.0 python-pycparser@2.20 python-cffi@1.14.4 python-bcrypt@3.2.0 python-markupsafe@1.1.1 python-jinja2@2.11.2 python-django@3.2.6 python-six@1.14.0 python-mock@3.0.5 python-pytest@5.3.5 python-execnet@1.9.0 python-py@1.8.1 python-pytest-bootstrap@5.3.5 python-pytest-forked@1.3.0 python-pytest-xdist@2.3.0 python-appdirs@1.4.3 python-distlib@0.3.0 python-filelock@3.0.12 python-sortedcontainers@2.1.0 python-hypothesis@5.4.1 python-nose@1.3.7 python-lxml@4.4.2 python-elementpath@1.4.0 python-xmlschema@1.1.2 python-pytest-bootstrap@6.2.4 python-toml@0.10.2 python-atomicwrites@1.3.0 python-attrs-bootstrap@19.3.0 python-more-itertools@8.2.0 python-packaging-bootstrap@20.0 python-pluggy@0.13.1 python-six-bootstrap@1.14.0 python-wcwidth@0.1.8 python-iniconfig@1.1.1 gdbm@1.18.1 sqlite@3.31.1 libxrender@0.9.10 libxft@2.3.3 gperf@3.1 gzip@1.10 bzip2@1.0.8 unzip@6.0 font-dejavu@2.37 libpng@1.6.37 freetype@2.10.4 tar@1.32 net-base@5.3 util-linux@2.35.1 fontconfig@2.13.1 tcl@8.6.10 xtrans@1.4.0 xcb-proto@1.14 libunistring@0.9.10 gettext-minimal@0.20.1 libgpg-error@1.37 libgcrypt@1.8.5 libxml2@2.9.10 readline@8.0.4 ncurses@6.2 bash@5.0.16 tzdata@2019c expat@2.2.9 libffi@3.3 perl@5.30.2 openssl@1.1.1j python-minimal@3.8.2 python-minimal-wrapper@3.8.2 zlib@1.2.11 xz@5.2.4 libxslt@1.1.34 libpthread-stubs@0.4 libxau@1.0.9 libbsd@0.10.0 libxdmcp@1.1.3 libxcb@1.14 libx11@1.6.10 pkg-config@0.29.2 util-macros@1.19.2 xorgproto@2019.2 libxext@1.3.4 tk@8.6.10 python@3.8.2 python-wrapper@3.8.2 python-setuptools-scm@3.4.3 python-py@1.10.0 python-pytest@6.2.4 tar@1.32 gzip@1.10 bzip2@1.0.8 xz@5.2.4 file@5.38 diffutils@3.7 patch@2.7.6 findutils@4.7.0 gawk@5.0.1 sed@4.8 grep@3.4 coreutils@8.32 make@4.3 guile@3.0.2 bash-minimal@5.0.16 ld-wrapper@0 binutils@2.34 gcc@7.5.0 glibc@2.31 glibc-utf8-locales@2.31

Any ideas how to make the test suite work?

Thank you!

bluetech commented 2 years ago

The main problem seems to be ModuleNotFoundError: No module named 'pytest_django_test'. It looks like a kind of issue caused by:

If you can figure out why imports of pytest_django_test are failing, I think it will fix the build. If there's anything pytest-django can improve/robustify in this regard, we'll be happy to.