mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Refs #31621 -- Fixed handling --parallel option in test management command and runtests.py.
Regression in ae89daf46f
.
Thanks Tim Graham for the report.
This commit is contained in:
parent
c2a5735d86
commit
36714be874
6 changed files with 72 additions and 47 deletions
|
@ -434,6 +434,12 @@ class ManageCommandParallelTests(SimpleTestCase):
|
|||
)
|
||||
self.assertEqual(stderr.getvalue(), '')
|
||||
|
||||
@mock.patch.dict(os.environ, {'DJANGO_TEST_PROCESSES': '7'})
|
||||
def test_no_parallel_django_test_processes_env(self, *mocked_objects):
|
||||
with captured_stderr() as stderr:
|
||||
call_command('test', testrunner='test_runner.tests.MockTestRunner')
|
||||
self.assertEqual(stderr.getvalue(), '')
|
||||
|
||||
@mock.patch.dict(os.environ, {'DJANGO_TEST_PROCESSES': 'invalid'})
|
||||
def test_django_test_processes_env_non_int(self, *mocked_objects):
|
||||
with self.assertRaises(ValueError):
|
||||
|
@ -443,6 +449,18 @@ class ManageCommandParallelTests(SimpleTestCase):
|
|||
testrunner='test_runner.tests.MockTestRunner',
|
||||
)
|
||||
|
||||
@mock.patch.dict(os.environ, {'DJANGO_TEST_PROCESSES': '7'})
|
||||
def test_django_test_processes_parallel_default(self, *mocked_objects):
|
||||
for parallel in ['--parallel', '--parallel=auto']:
|
||||
with self.subTest(parallel=parallel):
|
||||
with captured_stderr() as stderr:
|
||||
call_command(
|
||||
'test',
|
||||
parallel,
|
||||
testrunner='test_runner.tests.MockTestRunner',
|
||||
)
|
||||
self.assertIn('parallel=7', stderr.getvalue())
|
||||
|
||||
|
||||
class CustomTestRunnerOptionsSettingsTests(AdminScriptTestCase):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue