| class MyTestCase(unittest.TestCase): | |
| def setUp(self): | |
| self.foo_patcher = patch('__main__.Class', spec=True) | |
| self.foo_patcher.start() | |
| def tearDown(self): | |
| self.foo_patcher.stop() | |
| class TestThingie(MyTestCase): | |
| def test_thingie(self): | |
| thingie() | |
| self.assertEqual(1, self.foo_patcher.call_count) | |
| class TestAnotherThing(MyTestCase): | |
| def setUp(self): | |
| super(TestAnotherThing, self).setUp() # <-- this is important | |
| ... | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment