diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-12-31 10:01:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-31 10:01:31 +0100 |
| commit | d88ec42bd0a37340c8477a6f20bf26e58bd84735 (patch) | |
| tree | abd9422f7fb34a19579a74515ce84d9f472cd226 /tests/contenttypes_tests | |
| parent | 81ccf92f154c6d9eac3e30bac0aa67574d0ace15 (diff) | |
Used addCleanup() in tests where appropriate.
Diffstat (limited to 'tests/contenttypes_tests')
| -rw-r--r-- | tests/contenttypes_tests/test_models.py | 4 | ||||
| -rw-r--r-- | tests/contenttypes_tests/test_operations.py | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/tests/contenttypes_tests/test_models.py b/tests/contenttypes_tests/test_models.py index 36c14cf56f..02036de83f 100644 --- a/tests/contenttypes_tests/test_models.py +++ b/tests/contenttypes_tests/test_models.py @@ -12,9 +12,7 @@ from .models import Author, ConcreteModel, FooWithUrl, ProxyModel class ContentTypesTests(TestCase): def setUp(self): ContentType.objects.clear_cache() - - def tearDown(self): - ContentType.objects.clear_cache() + self.addCleanup(ContentType.objects.clear_cache) def test_lookup_cache(self): """ diff --git a/tests/contenttypes_tests/test_operations.py b/tests/contenttypes_tests/test_operations.py index a2bff373a4..d44648d9fe 100644 --- a/tests/contenttypes_tests/test_operations.py +++ b/tests/contenttypes_tests/test_operations.py @@ -29,11 +29,10 @@ class ContentTypeOperationsTests(TransactionTestCase): models.signals.post_migrate.connect( self.assertOperationsInjected, sender=app_config ) - - def tearDown(self): - app_config = apps.get_app_config("contenttypes_tests") - models.signals.post_migrate.disconnect( - self.assertOperationsInjected, sender=app_config + self.addCleanup( + models.signals.post_migrate.disconnect, + self.assertOperationsInjected, + sender=app_config, ) def assertOperationsInjected(self, plan, **kwargs): |
