Bug 2094340 - python-django fails to build with Python 3.11: tests failing due to enhanced tracebacks in Python 3.11
Summary: python-django fails to build with Python 3.11: tests failing due to enhanced ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-django
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-06-07 12:35 UTC by Tomáš Hrnčiar
Modified: 2022-06-08 11:01 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-06-08 11:01:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-06-07 12:35:49 UTC
python-django fails to build with Python 3.11.0b3.

======================================================================
FAIL: test_skip_if_db_feature (test_utils.tests.SkippingTestCase.test_skip_if_db_feature)
Testing the django.test.skipIfDBFeature decorator.
----------------------------------------------------------------------
ValueError: skipIfDBFeature cannot be used on test_foo (test_utils.tests.SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase.test_foo) as SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase doesn't allow queries against the 'default' database.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-4.0.2/tests/test_utils/tests.py", line 126, in test_skip_if_db_feature
    self._assert_skipping(
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Django-4.0.2/tests/test_utils/tests.py", line 43, in _assert_skipping
    with self.assertRaisesMessage(expected_exc, msg):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Django-4.0.2/django/test/testcases.py", line 687, in _assert_raises_or_warns_cm
    self.assertIn(expected_message, str(getattr(cm, cm_attr)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: "skipIfDBFeature cannot be used on test_foo (test_utils.tests.SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase) as SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase doesn't allow queries against the 'default' database." not found in "skipIfDBFeature cannot be used on test_foo (test_utils.tests.SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase.test_foo) as SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase doesn't allow queries against the 'default' database."

======================================================================
FAIL: test_skip_unless_db_feature (test_utils.tests.SkippingTestCase.test_skip_unless_db_feature)
Testing the django.test.skipUnlessDBFeature decorator.
----------------------------------------------------------------------
ValueError: skipUnlessDBFeature cannot be used on test_foo (test_utils.tests.SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase.test_foo) as SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase doesn't allow queries against the 'default' database.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-4.0.2/tests/test_utils/tests.py", line 82, in test_skip_unless_db_feature
    self._assert_skipping(
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Django-4.0.2/tests/test_utils/tests.py", line 43, in _assert_skipping
    with self.assertRaisesMessage(expected_exc, msg):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Django-4.0.2/django/test/testcases.py", line 687, in _assert_raises_or_warns_cm
    self.assertIn(expected_message, str(getattr(cm, cm_attr)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: "skipUnlessDBFeature cannot be used on test_foo (test_utils.tests.SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase) as SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase doesn't allow queries against the 'default' database." not found in "skipUnlessDBFeature cannot be used on test_foo (test_utils.tests.SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase.test_foo) as SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase doesn't allow queries against the 'default' database."

======================================================================
FAIL: test_add_failing_subtests (test_runner.test_parallel.RemoteTestResultTest.test_add_failing_subtests)
Failing subtests are added correctly using addSubTest().
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-4.0.2/tests/test_runner/test_parallel.py", line 126, in test_add_failing_subtests
    self.assertEqual(str(event[2]), 'dummy_test (test_runner.test_parallel.SampleFailingSubtest) (index=0)')
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'dumm[14 chars]unner.test_parallel.SampleFailingSubtest.dummy_test) (index=0)' != 'dumm[14 chars]unner.test_parallel.SampleFailingSubtest) (index=0)'
- dummy_test (test_runner.test_parallel.SampleFailingSubtest.dummy_test) (index=0)
?                                                           -----------
+ dummy_test (test_runner.test_parallel.SampleFailingSubtest) (index=0)


======================================================================
FAIL: test_parse_date (utils_tests.test_dateparse.DateParseTests.test_parse_date)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-4.0.2/tests/utils_tests/test_dateparse.py", line 17, in test_parse_date
    self.assertIsNone(parse_date('20120423'))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: datetime.date(2012, 4, 23) is not None

======================================================================
FAIL: test_parse_time (utils_tests.test_dateparse.DateParseTests.test_parse_time)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-4.0.2/tests/utils_tests/test_dateparse.py", line 36, in test_parse_time
    self.assertIsNone(parse_time('091500'))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: datetime.time(9, 15) is not None

======================================================================
FAIL: test_output_verbose (test_runner.test_debug_sql.TestDebugSQL.test_output_verbose)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Django-4.0.2/tests/test_runner/test_debug_sql.py", line 86, in test_output_verbose
    self.assertIn(output, full_output)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'runTest (test_runner.test_debug_sql.TestDebugSQL.FailingTest) ... FAIL' not found in 'runTest (test_runner.test_debug_sql.TestDebugSQL.FailingTest.runTest) ... FAIL\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'fail\'; args=(\'fail\',); alias=default\n----------------------------------------------------------------------\nrunTest (test_runner.test_debug_sql.TestDebugSQL.ErrorTest.runTest) ... ERROR\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'error\'; args=(\'error\',); alias=default\n----------------------------------------------------------------------\nrunTest (test_runner.test_debug_sql.TestDebugSQL.PassingTest.runTest) ... ok\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'pass\'; args=(\'pass\',); alias=default\n----------------------------------------------------------------------\nrunTest (test_runner.test_debug_sql.TestDebugSQL.PassingSubTest.runTest) ... ok\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'subtest-pass\'; args=(\'subtest-pass\',); alias=default\n----------------------------------------------------------------------\nrunTest (test_runner.test_debug_sql.TestDebugSQL.FailingSubTest.runTest) ... \n  runTest (test_runner.test_debug_sql.TestDebugSQL.FailingSubTest.runTest) (<subtest>) ... FAIL\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'subtest-fail\'; args=(\'subtest-fail\',); alias=default\n----------------------------------------------------------------------\nrunTest (test_runner.test_debug_sql.TestDebugSQL.ErrorSubTest.runTest) ... \n  runTest (test_runner.test_debug_sql.TestDebugSQL.ErrorSubTest.runTest) (<subtest>) ... ERROR\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'subtest-error\'; args=(\'subtest-error\',); alias=default\n----------------------------------------------------------------------\n\n======================================================================\nERROR: runTest (test_runner.test_debug_sql.TestDebugSQL.ErrorTest.runTest)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/Django-4.0.2/tests/test_runner/test_debug_sql.py", line 26, in runTest\n    raise Exception\n    ^^^^^^^^^^^^^^^\nException\n\n----------------------------------------------------------------------\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'error\'; args=(\'error\',); alias=default\n\n======================================================================\nERROR: runTest (test_runner.test_debug_sql.TestDebugSQL.ErrorSubTest.runTest) (<subtest>)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/Django-4.0.2/tests/test_runner/test_debug_sql.py", line 51, in runTest\n    raise Exception\n    ^^^^^^^^^^^^^^^\nException\n\n----------------------------------------------------------------------\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'subtest-error\'; args=(\'subtest-error\',); alias=default\n\n======================================================================\nFAIL: runTest (test_runner.test_debug_sql.TestDebugSQL.FailingTest.runTest)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/Django-4.0.2/tests/test_runner/test_debug_sql.py", line 21, in runTest\n    self.fail()\n    ^^^^^^^^^^^\nAssertionError: None\n\n----------------------------------------------------------------------\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'fail\'; args=(\'fail\',); alias=default\n\n======================================================================\nFAIL: runTest (test_runner.test_debug_sql.TestDebugSQL.FailingSubTest.runTest) (<subtest>)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File "/builddir/build/BUILD/Django-4.0.2/tests/test_runner/test_debug_sql.py", line 45, in runTest\n    self.fail()\n    ^^^^^^^^^^^\nAssertionError: None\n\n----------------------------------------------------------------------\n(0.000) SELECT COUNT(*) AS "__count" FROM "test_runner_person" WHERE "test_runner_person"."first_name" = \'subtest-fail\'; args=(\'subtest-fail\',); alias=default\n\n----------------------------------------------------------------------\nRan 6 tests in 0.108s\n\nFAILED (failures=2, errors=2)\n'

----------------------------------------------------------------------
Ran 15348 tests in 474.188s

FAILED (failures=6, skipped=1233, expected failures=4)

https://docs.python.org/3.11/whatsnew/3.11.html#enhanced-error-locations-in-tracebacks

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/04500556-python-django/

For all our attempts to build python-django with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-django/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2022-06-07 13:56:55 UTC
I am afraid we need to fix/workaround this one ourselves, see https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/AZRYATAXAK76MRKXXAJHEJNDZAHOMBE7/


Note You need to log in before you can comment on or make changes to this bug.