mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Added unittest cases to managed command parallel test.
This commit is contained in:
parent
2584783f46
commit
b1b774a34c
@ -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
|
||||
|
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user