Fixed #33855 -- Removed unnecessary system check calls from test worker initialization.

Regression in 3b3f38b3b0.
This commit is contained in:
Mariusz Felisiak 2022-07-19 09:45:11 +02:00 committed by GitHub
parent e59d1ff562
commit 24effbceb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -20,12 +20,7 @@ from io import StringIO
from django.core.management import call_command from django.core.management import call_command
from django.db import connections from django.db import connections
from django.test import SimpleTestCase, TestCase from django.test import SimpleTestCase, TestCase
from django.test.utils import ( from django.test.utils import NullTimeKeeper, TimeKeeper, iter_test_cases
NullTimeKeeper,
TimeKeeper,
captured_stdout,
iter_test_cases,
)
from django.test.utils import setup_databases as _setup_databases from django.test.utils import setup_databases as _setup_databases
from django.test.utils import setup_test_environment from django.test.utils import setup_test_environment
from django.test.utils import teardown_databases as _teardown_databases from django.test.utils import teardown_databases as _teardown_databases
@ -433,8 +428,6 @@ def _init_worker(
if value := serialized_contents.get(alias): if value := serialized_contents.get(alias):
connection._test_serialized_contents = value connection._test_serialized_contents = value
connection.creation.setup_worker_connection(_worker_id) connection.creation.setup_worker_connection(_worker_id)
with captured_stdout():
call_command("check", databases=connections)
def _run_subsuite(args): def _run_subsuite(args):

View File

@ -1,5 +1,7 @@
import multiprocessing
import sys import sys
from io import StringIO from io import StringIO
from unittest import skipIf
from django.apps import apps from django.apps import apps
from django.core import checks from django.core import checks
@ -361,6 +363,11 @@ class CheckFrameworkReservedNamesTests(SimpleTestCase):
self.assertEqual(errors, expected) self.assertEqual(errors, expected)
@skipIf(
multiprocessing.get_start_method() == "spawn",
"Spawning reimports modules, overwriting my_check.did_run to False, making this "
"test useless.",
)
class ChecksRunDuringTests(SimpleTestCase): class ChecksRunDuringTests(SimpleTestCase):
databases = "__all__" databases = "__all__"