mirror of
https://github.com/django/django.git
synced 2025-09-17 22:49:35 +00:00
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.
29 lines
733 B
Python
29 lines
733 B
Python
from django.db import models
|
|
|
|
|
|
class Person(models.Model):
|
|
first_name = models.CharField(max_length=20)
|
|
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):
|
|
person = models.ForeignKey(Person, models.CASCADE)
|
|
b = models.ForeignKey("B", models.CASCADE)
|
|
|
|
|
|
class Through(ThroughBase):
|
|
extra = models.CharField(max_length=20)
|
|
|
|
|
|
class B(models.Model):
|
|
people = models.ManyToManyField(Person, through=Through)
|