title: Django: reusing unit tests in other unit tests
body: <p>With two models:</p>
  
  <pre><code>class Model1(models.Model):
      attribute = models.CharField(max_length=100)
  
  class Model2(models.Model):
      target = models.ForeignKey(Model1)
  </code></pre>
  
  <p>And a unittest <code>tests.py</code>:</p>
  
  <pre><code>class Model1Test(TestCase):
      def test_make_new_model_and_save():
          m = Model1()
          m.attribute = 'test values'
          m.save()
  
  class Model2Test(TestCase):
      def test_make_new_model_and_save():
          # Make new Model1 to FK to
          m = Model1()
          m.attribute = 'test values'
          m.save()   
  
          m2 = Model2()
          m2.target = m
          m2.save()
  </code></pre>
  
  <p>I would like to just call the unittest function defined within Model1's test class, rather than duplicating the code again in order to test Model2. This I imagine to be like:</p>
  
  <pre><code>class Model1Test(TestCase):
      def test_make_new_model_and_save():
          m = Model1()
          m.attribute = 'test values'
          m.save()
          return m
  
  class Model2Test(TestCase):
      def test_make_new_model_and_save():
          # Make new Model1 to FK to
          m = Model1Test('test_make_new_model_and_save')
  
          m2 = Model2()
          m2.target = m
          m2.save()
  </code></pre>
  
  <p>But this doesn't seem to work and I immediately find myself in the internals of the unit testing framework. I can't find many references to this sort of thing, so being new to unit testing I feel I've taken a wrong turn somewhere.</p>
  
  <p>Is there 'normal' method of reusing unit tests, or is my approach flawed?</p>