#33719: Running tests in parallel throws exceptions in Django 4.1a1
---------------------------------------------+------------------------
               Reporter:  Pēteris Caune      |          Owner:  nobody
                   Type:  Uncategorized      |         Status:  new
              Component:  Testing framework  |        Version:  4.1
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 When I run `manage.py test --parallel`, I get:

 {{{
 Process ForkPoolWorker-387:
 Traceback (most recent call last):
   File "/usr/lib/python3.10/multiprocessing/process.py", line 315, in
 _bootstrap
     self.run()
   File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
     self._target(*self._args, **self._kwargs)
   File "/usr/lib/python3.10/multiprocessing/pool.py", line 109, in worker
     initializer(*initargs)
   File "/tmp/venv/lib/python3.10/site-packages/django/test/runner.py",
 line 415, in _init_worker
     with counter.get_lock():
 AttributeError: 'ParallelTestSuite' object has no attribute 'get_lock'
 Process ForkPoolWorker-388:
 Traceback (most recent call last):
   File "/usr/lib/python3.10/multiprocessing/process.py", line 315, in
 _bootstrap
     self.run()
   File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
     self._target(*self._args, **self._kwargs)
   File "/usr/lib/python3.10/multiprocessing/pool.py", line 109, in worker
     initializer(*initargs)
   File "/tmp/venv/lib/python3.10/site-packages/django/test/runner.py",
 line 415, in _init_worker
     with counter.get_lock():
 AttributeError: 'ParallelTestSuite' object has no attribute 'get_lock'
 (....)
 }}}

 How to reproduce:

 1. I created a new virtualenv and a new Django project:

 {{{
 python3 -m venv venv
 source venv/bin/activate
 pip install --pre django
 django-admin startproject woo
 }}}

 2. I created *two* test files:

 `woo/test_something.py`:

 {{{
 from django.test import TestCase

 class SomethingTestCase(TestCase):
     def test_it_works(self):
         pass
 }}}

 `woo/test_something_else.py`:

 {{{
 from django.test import TestCase

 class SomethingTestCase(TestCase):
     def test_it_works(self):
         pass
 }}}


 3. I ran the tests with the --parallel flag:

 {{{
 ./manage.py test --parallel
 }}}

 ----

 Django version: Django==4.1a1
 Python version: 3.10.4
 OS: Ubuntu 22.04

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33719>
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/01070180d63330d2-58ab22c9-4667-4473-a8cc-df97f64d7dd4-000000%40eu-central-1.amazonses.com.

Reply via email to