title: How to factorise python test cases with nosetests
body: <p>I have several functions on graph f(), g() and h() that implements different algorithms for the same problem. I would like to unit-test these functions using unittest framework.</p>
  
  <p>For each algorithm, several constraints should always be valid (such as empty graph, graph with only one node, and so on). The code for those common constraints checking should not be duplicated. So, the test architecture I started to design was the following:</p>
  
  <pre><code>class AbstractTest(TestCase):
    def test_empty(self):
        result = self.function(make_empty_graph())
        assertTrue(result....) # etc..
    def test_single_node(self):
        ...
  </code></pre>
  
  <p>Then the specific test cases</p>
  
  <pre><code>class TestF(AbstractTest):
    def setup(self):
        self.function = f
    def test_random(self):
        #specific test for algorithm 'f'
  
  class TestG(AbstractTest):
    def setup(self):
        self.function = g
    def test_complete_graph(self):
        #specific test for algorithm 'g'
  </code></pre>
  
  <p>... And so on for each algorithm</p>
  
  <p>Unfortunately,  nosetests, tries to execute each test in AbstractTest and it does not work since the actual self.function is specified in subclasses. I tried setting <code>__test__ = False</code> in the AbstractTest Case, but in this case, no test is executed at all (since this field is inherited I suppose). I tried with abstract base class (abc.ABCMeta) without success. I have read about MixIn without any result (I am not really confident with it).</p>
  
  <p>I am quite confident I am not the only one that try to factorize the test code. How do you do that in Python? </p>
  
  <p>Thanks.</p>