﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33719	Running tests in parallel throws exceptions.	Pēteris Caune	Mariusz Felisiak	"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
"	Bug	closed	Testing framework	4.1	Release blocker	fixed		David Smith Nick Pope Ahmad A. Hussein	Accepted	1	0	0	0	0	0
