diff options
author | Jonas Haag <jonas@lophus.org> | 2017-11-28 19:40:44 (GMT) |
---|---|---|
committer | Antoine Pitrou <pitrou@free.fr> | 2017-11-28 19:40:44 (GMT) |
commit | 4d193bcc2560b824389e4d98d9d8b9b34e33dbaf (patch) | |
tree | 18a9f541c72092fb0c13c588564d4e7a3a722e8e /Lib/unittest/loader.py | |
parent | a489599793f9b00ddc2c68e2ce3bce9cbb2c09a2 (diff) | |
download | cpython-4d193bcc2560b824389e4d98d9d8b9b34e33dbaf.zip cpython-4d193bcc2560b824389e4d98d9d8b9b34e33dbaf.tar.gz cpython-4d193bcc2560b824389e4d98d9d8b9b34e33dbaf.tar.bz2 |
bpo-32071: Fix regression and add What's New entry (#4589)
* bpo-32071: Fix an undocumented behaviour regression
* bpo-32071: Add 3.7 release note entry for unittest -k
Diffstat (limited to 'Lib/unittest/loader.py')
-rw-r--r-- | Lib/unittest/loader.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py index eb03b4a..d936a96 100644 --- a/Lib/unittest/loader.py +++ b/Lib/unittest/loader.py @@ -224,9 +224,10 @@ class TestLoader(object): """Return a sorted sequence of method names found within testCaseClass """ def shouldIncludeMethod(attrname): + if not attrname.startswith(self.testMethodPrefix): + return False testFunc = getattr(testCaseClass, attrname) - isTestMethod = attrname.startswith(self.testMethodPrefix) and callable(testFunc) - if not isTestMethod: + if not callable(testFunc): return False fullName = '%s.%s' % (testCaseClass.__module__, testFunc.__qualname__) return self.testNamePatterns is None or \ |