Hierarchical unit tests
Peter Otten
__peter__ at web.de
Wed Aug 2 03:41:11 EDT 2006
Pupeno wrote:
> Having A(unittest.TestCase) and B(A), the unittests framework seems not to
> run A's test when testing B, right ?
Wrong:
$ cat hierarchical_tests.py
import unittest
class A(unittest.TestCase):
def test_a(self):
pass
class B(A):
def test_b(self):
pass
if __name__ == "__main__":
unittest.main()
$ python hierarchical_tests.py -v
test_a (__main__.A) ... ok
test_a (__main__.B) ... ok
test_b (__main__.B) ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.001s
OK
Peter
More information about the Python-list
mailing list