diff --git a/README.rst b/README.rst index a52d492..18f12b4 100644 --- a/README.rst +++ b/README.rst @@ -71,14 +71,6 @@ or simply by changing its attributes: # Globally disables SQL caching until you set it back to True cachalot_settings.CACHALOT_ENABLED = False - from django.test import TestCase - - @cachalot_settings(CACHALOT_ENABLED=True) - class YourTestCase(TestCase): - # SQL caching is enabled again in every method of this test - - # SQL caching is disabled again because we globally disabled it - In tests, you can use `Django’s testing tools `_ as well as ``cachalot_settings``. They will both work the same. diff --git a/cachalot/tests.py b/cachalot/tests.py index 5991b52..6a14ef6 100644 --- a/cachalot/tests.py +++ b/cachalot/tests.py @@ -1181,23 +1181,14 @@ class AtomicTestCase(TestCase): self.assertListEqual(data3, [t1]) -@cachalot_settings(CACHALOT_ENABLED=False) -class SettingsDecoratorTestCase(TestCase): - def test_class(self): - with self.assertNumQueries(1): - list(Test.objects.all()) - with self.assertNumQueries(1): - list(Test.objects.all()) - - @cachalot_settings(CACHALOT_ENABLED=True) - def test_method(self): - with self.assertNumQueries(1): - list(Test.objects.all()) - with self.assertNumQueries(0): - list(Test.objects.all()) - - class SettingsTestCase(TestCase): + @cachalot_settings(CACHALOT_ENABLED=False) + def test_decorator(self): + with self.assertNumQueries(1): + list(Test.objects.all()) + with self.assertNumQueries(1): + list(Test.objects.all()) + def test_enabled(self): with cachalot_settings(CACHALOT_ENABLED=True): with self.assertNumQueries(1):