[issue32071] Add py.test-like "-k" test selection to unittest
Jonas H.
report at bugs.python.org
Mon Nov 27 11:12:54 EST 2017
Jonas H. <jonas at lophus.org> added the comment:
Ah, the problem isn't that it's running getattr() on test methods, but that it runs getattr() on all methods.
Former code: attrname.startswith(prefix) and \
callable(getattr(testCaseClass, attrname))
New code: testFunc = getattr(testCaseClass, attrname)
isTestMethod = attrname.startswith(self.testMethodPrefix) and callable(testFunc)
This is trivial to fix. @Core devs: Should I revert to original behaviour with the order of the prefix check and the getattr() call, and add a regression test that guarantees this behaviour?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32071>
_______________________________________
More information about the Python-bugs-list
mailing list