summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-07 11:57:46 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-10 12:01:00 +0200
commitb61ea56789a5825bd2961a335cb82f65e09f1614 (patch)
tree96540b71c4380dd930b63cd08d19c59b6b50fdfa /tests
parentf1894bae3071da4ee577fc40ae61491f3e03d82c (diff)
Refs #28478 -- Removed support for TestCase's allow_database_queries and multi_db per deprecation timeline.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_utils/test_deprecated_features.py64
1 files changed, 0 insertions, 64 deletions
diff --git a/tests/test_utils/test_deprecated_features.py b/tests/test_utils/test_deprecated_features.py
deleted file mode 100644
index fbed5e14c5..0000000000
--- a/tests/test_utils/test_deprecated_features.py
+++ /dev/null
@@ -1,64 +0,0 @@
-from django.db import connections
-from django.db.utils import DEFAULT_DB_ALIAS
-from django.test import SimpleTestCase, TestCase, TransactionTestCase
-from django.utils.deprecation import RemovedInDjango31Warning
-
-
-class AllowDatabaseQueriesDeprecationTests(SimpleTestCase):
- def test_enabled(self):
- class AllowedDatabaseQueries(SimpleTestCase):
- allow_database_queries = True
- message = (
- '`SimpleTestCase.allow_database_queries` is deprecated. Restrict '
- 'the databases available during the execution of '
- 'test_utils.test_deprecated_features.AllowDatabaseQueriesDeprecationTests.'
- 'test_enabled.<locals>.AllowedDatabaseQueries with the '
- '`databases` attribute instead.'
- )
- with self.assertWarnsMessage(RemovedInDjango31Warning, message):
- self.assertEqual(AllowedDatabaseQueries.databases, {'default'})
-
- def test_explicitly_disabled(self):
- class AllowedDatabaseQueries(SimpleTestCase):
- allow_database_queries = False
- message = (
- '`SimpleTestCase.allow_database_queries` is deprecated. Restrict '
- 'the databases available during the execution of '
- 'test_utils.test_deprecated_features.AllowDatabaseQueriesDeprecationTests.'
- 'test_explicitly_disabled.<locals>.AllowedDatabaseQueries with '
- 'the `databases` attribute instead.'
- )
- with self.assertWarnsMessage(RemovedInDjango31Warning, message):
- self.assertEqual(AllowedDatabaseQueries.databases, set())
-
-
-class MultiDbDeprecationTests(SimpleTestCase):
- def test_transaction_test_case(self):
- class MultiDbTestCase(TransactionTestCase):
- multi_db = True
- message = (
- '`TransactionTestCase.multi_db` is deprecated. Databases '
- 'available during this test can be defined using '
- 'test_utils.test_deprecated_features.MultiDbDeprecationTests.'
- 'test_transaction_test_case.<locals>.MultiDbTestCase.databases.'
- )
- with self.assertWarnsMessage(RemovedInDjango31Warning, message):
- self.assertEqual(MultiDbTestCase.databases, set(connections))
- MultiDbTestCase.multi_db = False
- with self.assertWarnsMessage(RemovedInDjango31Warning, message):
- self.assertEqual(MultiDbTestCase.databases, {DEFAULT_DB_ALIAS})
-
- def test_test_case(self):
- class MultiDbTestCase(TestCase):
- multi_db = True
- message = (
- '`TestCase.multi_db` is deprecated. Databases available during '
- 'this test can be defined using '
- 'test_utils.test_deprecated_features.MultiDbDeprecationTests.'
- 'test_test_case.<locals>.MultiDbTestCase.databases.'
- )
- with self.assertWarnsMessage(RemovedInDjango31Warning, message):
- self.assertEqual(MultiDbTestCase.databases, set(connections))
- MultiDbTestCase.multi_db = False
- with self.assertWarnsMessage(RemovedInDjango31Warning, message):
- self.assertEqual(MultiDbTestCase.databases, {DEFAULT_DB_ALIAS})