Author chris.jerdonek
Recipients brett.cannon, chris.jerdonek, eric.araujo, ezio.melotti, python-dev, r.david.murray, serhiy.storchaka, terry.reedy, zach.ware
Date 2013-01-11.10:26:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
As suggested in the previous comment, here is simple code to find candidates for test duplication (TestCase subclasses subclassing other TestCase classes):

def find_dupes(mod):
    objects = [getattr(mod, name) for name in sorted(dir(mod))]
    classes = [obj for obj in objects if isinstance(obj, type) and
               issubclass(obj, unittest.TestCase)]
    for c in classes:
        for d in classes:
            if c is not d and issubclass(d, c):
                print("%s: %s < %s" % (mod.__name__, c.__name__, d.__name__))

Out of curiosity, I ran a modified form of this against all test modules to find which ones fit this pattern and *already* rely on unittest discovery (i.e. don't have test_main()).  We might want to adjust these as well.  There were four: test_asyncore, test_configparser, test_heapq, test_ipaddress
Date User Action Args
2013-01-11 10:26:34chris.jerdoneksetrecipients: + chris.jerdonek, brett.cannon, terry.reedy, ezio.melotti, eric.araujo, r.david.murray, python-dev, zach.ware, serhiy.storchaka
2013-01-11 10:26:34chris.jerdoneksetmessageid: <>
2013-01-11 10:26:34chris.jerdoneklinkissue16748 messages
2013-01-11 10:26:33chris.jerdonekcreate