From 58e548db8b74e3d265a2e94816489cd0caeeaf91 Mon Sep 17 00:00:00 2001 From: Jake Howard <git@theorangeone.net> Date: Fri, 27 Sep 2024 14:13:02 +0100 Subject: [PATCH] Fixed #35952 -- Used class property for available apps check on TransactionTestCase. --- tests/runtests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/runtests.py b/tests/runtests.py index 516da84768..57d4fcea72 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -32,9 +32,11 @@ else: RemovedInDjango60Warning, RemovedInDjango61Warning, ) + from django.utils.functional import classproperty from django.utils.log import DEFAULT_LOGGING from django.utils.version import PY312, PYPY + try: import MySQLdb except ImportError: @@ -307,12 +309,12 @@ def setup_run_tests(verbosity, start_at, start_after, test_labels=None): apps.set_installed_apps(settings.INSTALLED_APPS) # Force declaring available_apps in TransactionTestCase for faster tests. - def no_available_apps(self): + def no_available_apps(cls): raise Exception( "Please define available_apps in TransactionTestCase and its subclasses." ) - TransactionTestCase.available_apps = property(no_available_apps) + TransactionTestCase.available_apps = classproperty(no_available_apps) TestCase.available_apps = None # Set an environment variable that other code may consult to see if