Can a python unittest class add an assert statement for each test method in a parent class?
<p>I have a unit test class that is a sub-class of python's <code>unittest</code>:</p>

<pre><code>import unittest

class MyTestClass(unittest.TestCase):
    run_parameters = {param1: 'on'}
    def someTest(self):
        self.assertEquals(something, something_else)
</code></pre>

<p>Now I want to create a child class that modifies, say <code>run_parameters</code>, and adds an additional assert statement on top of what was already written:</p>

<pre><code>class NewWayToRunThings_TestClass(MyTestClass):
        run_parameters = {param1: 'blue'}
        # Want someTest, and all other tests in MyTestClass to now run 
        # with an additional assert statement  
</code></pre>

<p>Is there someway to accomplish this so that each test runs with an additional assert statement to check that my parameter change worked properly across all my tests?</p>

<p>Yes there is but it may not be a good idea because:</p>

<ul>
<li>assertions are hidden behind difficult to understand python magic</li>
<li>assertions aren't explicit</li>
</ul>

<p>Could you update your methods to reflect the new contract, and expected param?</p>

<p>Also if a single parameter change breaks a huge amount of tests, where it is easier to dynamically patch the test class then it is to update the tests, the test suite may not be focused enough.  </p>

python unit-testing oop