mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #35952 -- Used class property for available apps check on TransactionTestCase.
This commit is contained in:
parent
d2f2a6a6d5
commit
58e548db8b
@ -32,9 +32,11 @@ else:
|
|||||||
RemovedInDjango60Warning,
|
RemovedInDjango60Warning,
|
||||||
RemovedInDjango61Warning,
|
RemovedInDjango61Warning,
|
||||||
)
|
)
|
||||||
|
from django.utils.functional import classproperty
|
||||||
from django.utils.log import DEFAULT_LOGGING
|
from django.utils.log import DEFAULT_LOGGING
|
||||||
from django.utils.version import PY312, PYPY
|
from django.utils.version import PY312, PYPY
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import MySQLdb
|
import MySQLdb
|
||||||
except ImportError:
|
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)
|
apps.set_installed_apps(settings.INSTALLED_APPS)
|
||||||
|
|
||||||
# Force declaring available_apps in TransactionTestCase for faster tests.
|
# Force declaring available_apps in TransactionTestCase for faster tests.
|
||||||
def no_available_apps(self):
|
def no_available_apps(cls):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"Please define available_apps in TransactionTestCase and its subclasses."
|
"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
|
TestCase.available_apps = None
|
||||||
|
|
||||||
# Set an environment variable that other code may consult to see if
|
# Set an environment variable that other code may consult to see if
|
||||||
|
Loading…
Reference in New Issue
Block a user