Loading django/test/runner.py +11 −1 Original line number Diff line number Diff line Loading @@ -453,7 +453,17 @@ class DiscoverRunner(object): suite = reorder_suite(suite, self.reorder_by, self.reverse) if self.parallel > 1: suite = self.parallel_test_suite(suite, self.parallel, self.failfast) parallel_suite = self.parallel_test_suite(suite, self.parallel, self.failfast) # Since tests are distributed across processes on a per-TestCase # basis, there's no need for more processes than TestCases. parallel_units = len(parallel_suite.subsuites) if self.parallel > parallel_units: self.parallel = parallel_units # If there's only one TestCase, parallelization isn't needed. if self.parallel > 1: suite = parallel_suite return suite Loading docs/ref/django-admin.txt +4 −0 Original line number Diff line number Diff line Loading @@ -1274,6 +1274,10 @@ By default ``--parallel`` runs one process per core according to either by providing it as the option's value, e.g. ``--parallel=4``, or by setting the ``DJANGO_TEST_PROCESSES`` environment variable. Django distributes test cases — :class:`unittest.TestCase` subclasses — to subprocesses. If there are fewer test cases than configured processes, Django will reduce the number of processes accordingly. Each process gets its own database. You must ensure that different test cases don't access the same resources. For instance, test cases that touch the filesystem should create a temporary directory for their own use. Loading Loading
django/test/runner.py +11 −1 Original line number Diff line number Diff line Loading @@ -453,7 +453,17 @@ class DiscoverRunner(object): suite = reorder_suite(suite, self.reorder_by, self.reverse) if self.parallel > 1: suite = self.parallel_test_suite(suite, self.parallel, self.failfast) parallel_suite = self.parallel_test_suite(suite, self.parallel, self.failfast) # Since tests are distributed across processes on a per-TestCase # basis, there's no need for more processes than TestCases. parallel_units = len(parallel_suite.subsuites) if self.parallel > parallel_units: self.parallel = parallel_units # If there's only one TestCase, parallelization isn't needed. if self.parallel > 1: suite = parallel_suite return suite Loading
docs/ref/django-admin.txt +4 −0 Original line number Diff line number Diff line Loading @@ -1274,6 +1274,10 @@ By default ``--parallel`` runs one process per core according to either by providing it as the option's value, e.g. ``--parallel=4``, or by setting the ``DJANGO_TEST_PROCESSES`` environment variable. Django distributes test cases — :class:`unittest.TestCase` subclasses — to subprocesses. If there are fewer test cases than configured processes, Django will reduce the number of processes accordingly. Each process gets its own database. You must ensure that different test cases don't access the same resources. For instance, test cases that touch the filesystem should create a temporary directory for their own use. Loading