0
0
mirror of https://github.com/django/django.git synced 2024-11-24 20:07:01 +01:00

Added unittest cases to managed command parallel test.

This commit is contained in:
Jebaseelanravi 2023-07-08 03:23:48 +05:30
parent 2584783f46
commit b1b774a34c
2 changed files with 11 additions and 1 deletions

View File

@ -1477,7 +1477,7 @@ Using ``--parallel`` without a value, or with the value ``auto``, runs one test
process per core according to :func:`multiprocessing.cpu_count()`. You can
override this by passing the desired number of processes, e.g.
``--parallel 4``, or by setting the :envvar:`DJANGO_TEST_PROCESSES` environment
variable.
variable. If both are given, then ``--parallel 4`` takes precedence.
Django distributes test cases — :class:`unittest.TestCase` subclasses — to
subprocesses. If there are fewer test cases than configured processes, Django

View File

@ -550,6 +550,16 @@ class ManageCommandParallelTests(SimpleTestCase):
)
self.assertIn("parallel=7", stderr.getvalue())
@mock.patch.dict(os.environ, {"DJANGO_TEST_PROCESSES": "7"})
def test_django_test_processes_parallel_override_env(self, *mocked_objects):
with captured_stderr() as stderr:
call_command(
"test",
"--parallel=8",
testrunner="test_runner.tests.MockTestRunner",
)
self.assertIn("parallel=8", stderr.getvalue())
class CustomTestRunnerOptionsSettingsTests(AdminScriptTestCase):
"""