#34930: Parallel tests fail on Python 3.11+ and django 4.1.0+ when
IsolatedAsyncioTestCase is used
-------------------------------------+-------------------------------------
     Reporter:  Matt Hegarty         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Testing framework    |                  Version:  4.2
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  pickle               |             Triage Stage:
  _contextvars.Context _contextvars  |  Unreviewed
  Context                            |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Natalia Bidart):

 Replying to [comment:5 Matt Hegarty]:
 > - The tests pass for me when running against `stable/4.0.x` (python
 3.11) (i.e. no crash)
 > - I have updated the
 
[https://github.com/matthewhegarty/tutorial/commit/640533b5703d93f30aa8a3fb96abcf5e3a3045be
 test project] to see if you can reproduce

 Thanks Matt for the extra details but it fails for me with `4.0.x`:

 {{{
 [~/fellowship/tutorial main|✚ 1…1]$ python -c "import django;
 print(django.get_version())"
 4.0.11

 [~/fellowship/tutorial main|✚ 1…1]$ ./manage.py test --parallel
 Found 4 test(s).
 System check identified no issues (0 silenced).
 Traceback (most recent call last):
   File "/home/nessita/fellowship/tutorial/./manage.py", line 22, in
 <module>
     main()
   File "/home/nessita/fellowship/tutorial/./manage.py", line 18, in main
     execute_from_command_line(sys.argv)
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/core/management/__init__.py", line 446, in
 execute_from_command_line
     utility.execute()
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/core/management/__init__.py", line 440, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/core/management/commands/test.py", line 24, in
 run_from_argv
     super().run_from_argv(argv)
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/core/management/base.py", line 414, in run_from_argv
     self.execute(*args, **cmd_options)
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/core/management/base.py", line 460, in execute
     output = self.handle(*args, **options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/core/management/commands/test.py", line 68, in handle
     failures = test_runner.run_tests(test_labels)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/test/runner.py", line 1006, in run_tests
     result = self.run_suite(suite)
              ^^^^^^^^^^^^^^^^^^^^^
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/test/runner.py", line 930, in run_suite
     return runner.run(suite)
            ^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/unittest/runner.py", line 217, in run
     test(result)
   File "/usr/lib/python3.11/unittest/suite.py", line 84, in __call__
     return self.run(*args, **kwds)
            ^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/nessita/.virtualenvs/djangodev/lib/python3.11/site-
 packages/django/test/runner.py", line 493, in run
     subsuite_index, events = test_results.next(timeout=0.1)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/multiprocessing/pool.py", line 873, in next
     raise value
   File "/usr/lib/python3.11/multiprocessing/pool.py", line 540, in
 _handle_tasks
     put(task)
   File "/usr/lib/python3.11/multiprocessing/connection.py", line 205, in
 send
     self._send_bytes(_ForkingPickler.dumps(obj))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/multiprocessing/reduction.py", line 51, in
 dumps
     cls(buf, protocol).dump(obj)
 TypeError: cannot pickle '_contextvars.Context' object
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34930#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018b70ffe1ab-4472f063-2fe1-4401-abb7-f01af6e0f9f6-000000%40eu-central-1.amazonses.com.

Reply via email to