summaryrefslogtreecommitdiff
path: root/tests/test_runner/models.py
diff options
context:
space:
mode:
authorAdam Zapletal <adamzap@gmail.com>2025-01-18 16:22:10 -0600
committerJacob Walls <jacobtylerwalls@gmail.com>2025-09-16 21:57:22 -0400
commit606fc352799e372928fa2c978ab99f0fb6d6017c (patch)
tree789edf713bd71ab9ad5c4e1bc0acafba380c0734 /tests/test_runner/models.py
parent2063c88c34566f46ad120c5b37c9926ffd3f10a6 (diff)
Fixed #36083 -- Ran system checks in ParallelTestSuite workers.
Workers created by ParallelTestSuite were not running system checks in the spawn multiprocessing mode. In general this is fine, but system checks can have side effects expected by tests. This patch runs system checks inside of _init_worker, which is only called by ParallelTestSuite.
Diffstat (limited to 'tests/test_runner/models.py')
-rw-r--r--tests/test_runner/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_runner/models.py b/tests/test_runner/models.py
index 80bf8dd8c7..54ec5e2b3d 100644
--- a/tests/test_runner/models.py
+++ b/tests/test_runner/models.py
@@ -6,6 +6,13 @@ class Person(models.Model):
last_name = models.CharField(max_length=20)
friends = models.ManyToManyField("self")
+ system_check_run_count = 0
+
+ @classmethod
+ def check(cls, *args, **kwargs):
+ cls.system_check_run_count += 1
+ return super().check(**kwargs)
+
# A set of models that use a non-abstract inherited 'through' model.
class ThroughBase(models.Model):