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/cache | |
| parent | 81ccf92f154c6d9eac3e30bac0aa67574d0ace15 (diff) | |
Used addCleanup() in tests where appropriate.
Diffstat (limited to 'tests/cache')
| -rw-r--r-- | tests/cache/tests.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py index c2a1ebdbb8..e6ebb718f1 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -1155,11 +1155,7 @@ class DBCacheTests(BaseCacheTests, TransactionTestCase): # The super calls needs to happen first for the settings override. super().setUp() self.create_table() - - def tearDown(self): - # The super call needs to happen first because it uses the database. - super().tearDown() - self.drop_table() + self.addCleanup(self.drop_table) def create_table(self): management.call_command("createcachetable", verbosity=0) @@ -2509,12 +2505,9 @@ class CacheMiddlewareTest(SimpleTestCase): def setUp(self): self.default_cache = caches["default"] + self.addCleanup(self.default_cache.clear) self.other_cache = caches["other"] - - def tearDown(self): - self.default_cache.clear() - self.other_cache.clear() - super().tearDown() + self.addCleanup(self.other_cache.clear) def test_constructor(self): """ |
