testutils.py 427 B

1234567891011121314151617181920
  1. from django.test import TestCase
  2. from . import threadstore
  3. from .cache import cache
  4. class MisagoTestCase(TestCase):
  5. """TestCase class that empties global state before and after each test"""
  6. def clear_state(self):
  7. cache.clear()
  8. threadstore.clear()
  9. def setUp(self):
  10. super().setUp()
  11. self.clear_state()
  12. def tearDown(self):
  13. self.clear_state()
  14. super().tearDown()