diff options
author | dglasser <dglasser@b1010a0a-674b-0410-b734-77272b80c875> | 2008-07-01 01:43:55 +0000 |
---|---|---|
committer | dglasser <dglasser@b1010a0a-674b-0410-b734-77272b80c875> | 2008-07-01 01:43:55 +0000 |
commit | 5a84531d0e4f81fa4af078140a97b82aeca7c4c5 (patch) | |
tree | fd45b7575ba3caa42a345752e2c5881e123c84cb /mox_test.py | |
parent | 6fcef3d03b8868d5cdead9625572e2db666e5236 (diff) | |
download | pymox-5a84531d0e4f81fa4af078140a97b82aeca7c4c5.tar.gz |
Fix MoxTestBase to be usable with multiple-inheritance.
MoxTestBase was redefining setUp() but it didn't use super() to
call setUp recursively on the other parent classes defined in MRO.
Patch by: Benoit Sigoure <tsuna@lrde.epita.fr>
Diffstat (limited to 'mox_test.py')
-rwxr-xr-x | mox_test.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mox_test.py b/mox_test.py index df83c45..be35bae 100755 --- a/mox_test.py +++ b/mox_test.py @@ -1250,6 +1250,26 @@ class ResetTest(unittest.TestCase): self.assertEquals(0, len(mock_obj._expected_calls_queue)) +class MyTestCase(unittest.TestCase): + """Simulate the use of a fake wrapper around Python's unittest library.""" + + def setUp(self): + super(MyTestCase, self).setUp() + self.critical_variable = 42 + + +class MoxTestBaseMultipleInheritanceTest(mox.MoxTestBase, MyTestCase): + """Test that multiple inheritance can be used with MoxTestBase.""" + + def setUp(self): + super(MoxTestBaseMultipleInheritanceTest, self).setUp() + + def testMultipleInheritance(self): + """Should be able to access members created by all parent setUp().""" + self.assert_(isinstance(self.mox, mox.Mox)) + self.assertEquals(42, self.critical_variable) + + class TestClass: """This class is used only for testing the mock framework""" |