title: How do I prevent Django from running unit tests on parent class when subclassing TestCase?
body: <p><strong>Background:</strong> I am working on a web scraper to track prices at online stores. It uses Django. I have a module for each store, with functions like <code>get_price()</code> and <code>get_product_name()</code> written for each one, so that the modules can be used interchangeably by the main scraper module. I have store_a.py, store_b.py, store_c.py, et cetera, each with these functions defined. </p>
  
  <p>In order to prevent duplication of code, I've made StoreTestCase, which inherits from TestCase. For each store, I have a subclass of StoreTestCase, like StoreATestCase and StoreBTestCase.</p>
  
  <p>When I manually test the StoreATestCase <em>class</em>, the test runner does what I want. It uses the data in the child class <code>self.data</code> for its tests, and doesn't attempt to set up and test the parent class on its own:</p>
  
  <pre><code>python manage.py test myproject.tests.test_store_a.StoreATest
  </code></pre>
  
  <p>However, when I manually test against the <em>module</em>, like:</p>
  
  <pre><code>python manage.py test myproject.tests.test_store_a
  </code></pre>
  
  <p>It first runs the tests for the child class and succeeds, but then it runs them for the parent class and returns the following error:</p>
  
  <pre><code>    for page in self.data:
  TypeError: 'NoneType' object is not iterable
  </code></pre>
  
  <p><strong>store_test.py</strong> (parent class)</p>
  
  <pre><code>from django.test import TestCase
  
  class StoreTestCase(TestCase):
  
      def setUp(self):
          '''This should never execute but it does when I test test_store_a'''
          self.data = None
      def test_get_price(self):
          for page in self.data:
              self.assertEqual(store_a.get_price(page['url']), page['expected_price'])
  </code></pre>
  
  <p><strong>test_store_a.py</strong> (child class)</p>
  
  <pre><code>import store_a
  from store_test import StoreTestCase
  
  class StoreATestCase(StoreTestCase):
  
      def setUp(self):
          self.data = [{'url': 'http://www.foo.com/bar', 'expected_price': 7.99},
                       {'url': 'http://www.foo.com/baz', 'expected_price': 12.67}]
  </code></pre>
  
  <p>How do I ensure the Django test runner only tests the child class, and not the parent class?</p>