summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Howard <git@theorangeone.net>2024-09-27 14:13:02 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-04 09:36:40 +0100
commit58e548db8b74e3d265a2e94816489cd0caeeaf91 (patch)
tree07da809f0e8a4a9d6cc071071e55b88bd231de81
parentd2f2a6a6d5cf40ec6dffdc9a195f71bedd72acb4 (diff)
Fixed #35952 -- Used class property for available apps check on TransactionTestCase.
-rwxr-xr-xtests/runtests.py6
1 files 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