diff options
| author | Tim Graham <timograham@gmail.com> | 2017-02-13 08:46:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-13 08:46:00 -0500 |
| commit | 3f5a35d6e2dfc0c981dbd8945a8c7cd35c32e5c8 (patch) | |
| tree | 35e68f77739db4f22f098f13a51ea12b35e056e6 /django/test/testcases.py | |
| parent | 9718fa2e8abe430c3526a9278dd976443d4ae3c6 (diff) | |
Added TransactionTestCase.multi_db instead of using getattr().
Diffstat (limited to 'django/test/testcases.py')
| -rw-r--r-- | django/test/testcases.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index 7955488f48..b8d57378de 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -781,6 +781,9 @@ class TransactionTestCase(SimpleTestCase): # Subclasses can define fixtures which will be automatically installed. fixtures = None + # Do the tests in this class query non-default databases? + multi_db = False + # If transactions aren't available, Django will serialize the database # contents into a fixture during setup and flush and reload them # during teardown (as flush does not restore data from migrations). @@ -827,7 +830,7 @@ class TransactionTestCase(SimpleTestCase): def _databases_names(cls, include_mirrors=True): # If the test case has a multi_db=True flag, act on all databases, # including mirrors or not. Otherwise, just on the default DB. - if getattr(cls, 'multi_db', False): + if cls.multi_db: return [ alias for alias in connections if include_mirrors or not connections[alias].settings_dict['TEST']['MIRROR'] |
