fixes method-related filter for tests of suite loaded with loadTestsFromName (they may be a suite self)

pull/1562/head
sebres 2016-09-30 11:26:49 +02:00
parent 77ec9df678
commit 9a7c753372
1 changed files with 5 additions and 0 deletions

View File

@ -330,6 +330,11 @@ def gatherTests(regexps=None, opts=None):
def addTest(self, suite):
matched = []
for test in suite:
# test of suite loaded with loadTestsFromName may be a suite self:
if isinstance(test, unittest.TestSuite): # pragma: no cover
self.addTest(test)
continue
# filter by regexp:
s = str(test)
for r in self._regexps:
m = r.search(s)