1. from django.test import SimpleTestCase
    
  2. from django.test.testcases import SerializeMixin
    
  3. 
    
  4. 
    
  5. class TestSerializeMixin(SimpleTestCase):
    
  6.     def test_init_without_lockfile(self):
    
  7.         msg = (
    
  8.             "ExampleTests.lockfile isn't set. Set it to a unique value in the "
    
  9.             "base class."
    
  10.         )
    
  11.         with self.assertRaisesMessage(ValueError, msg):
    
  12. 
    
  13.             class ExampleTests(SerializeMixin, SimpleTestCase):
    
  14.                 pass
    
  15. 
    
  16. 
    
  17. class TestSerializeMixinUse(SerializeMixin, SimpleTestCase):
    
  18.     lockfile = __file__
    
  19. 
    
  20.     def test_usage(self):
    
  21.         # Running this test ensures that the lock/unlock functions have passed.
    
  22.         pass