MarkBerlin78 / pymox

Automatically exported from code.google.com/p/pymox
Apache License 2.0
0 stars 0 forks source link

MoxTestBase silently ignores overriding test methods #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create and run the following script:

#!/usr/bin/python
import unittest
import mox

class Test1(mox.MoxTestBase):
    def testOK(self):
        self.assertEquals(1, 1)

class Test2(Test1):
    def testOK(self):
        self.assertEquals(1, 2)

if __name__ == '__main__':
    unittest.main()

What is the expected output?

FAIL: testOK (__main__.Test2)
Traceback (most recent call last):
  File "./lib/apt_forktracer/tests/test_mox.py", line 28, in testOK
    self.assertEquals(1, 2)
AssertionError: 1 != 2

----------------------------------------------------------------------
Ran 2 tests in 0.001s

FAILED (failures=1)

What do you see instead?

..
----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK

What version of the product are you using?

0.5.1-1

On what operating system?

Ubuntu

Please provide any additional information below.

If I use plain unittest.TestCase everything works as expected - Test2.testOK 
overrides 
Test1.testOK and two methods are run: Test1.testOK and Test2.testOK

However when using mox.MoxTestBase, the same Test1.testOK method is run twice! 
Once in Test1 
context, once in Test2 context.

This is using python 2.5.2

Original issue reported on code.google.com by marcin.o...@gmail.com on 28 Mar 2010 at 2:44

GoogleCodeExporter commented 9 years ago
A fix for this is included in r40 already. Please consider using latest trunk 
while a 
new release is cut out.

Cheers.

Original comment by dato@google.com on 6 Apr 2010 at 12:07

GoogleCodeExporter commented 9 years ago

Original comment by steve.mi...@gmail.com on 17 Jun 2010 at 7:56