[issue1955] fix using unittest as a superclass

Adam Goucher report at bugs.python.org
Mon Jan 28 15:39:39 CET 2008


New submission from Adam Goucher:

There are a couple places in unittest where 'issubclass(something,
TestCase)' is used. This prevents you from organizing your test code via
class hierarchies. To solve this problem, issubclass should be looking
whether the object is a subclass of unittest.TestCase to walk the
inheritance tree all the way up and not just a single level.

Currently, this will not work.
module A..
class A(unittest.TestCase):
    pass

module B...
import A

class B(A.A)
    def testFoo(self):
        print "blah blah blah

I have attached a patch which will address all locations where this
could happen.

----------
components: Library (Lib)
files: cpython-unittest-subclass.diff
messages: 61776
nosy: agoucher
severity: normal
status: open
title: fix using unittest as a superclass
versions: Python 2.5
Added file: http://bugs.python.org/file9311/cpython-unittest-subclass.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1955>
__________________________________


More information about the Python-bugs-list mailing list