[issue16079] list duplicate test names with patchcheck

Chris Jerdonek report at bugs.python.org
Fri Sep 28 18:52:06 CEST 2012


Chris Jerdonek added the comment:

I would like to see this written in a way that would let one run it globally or on a single file independent of a patch (e.g. an independent script from which patchcheck could import certain functions).  Or is that what you explicitly didn't want Éric? :)

This would let one do a report or global check as was done for issue 16056.  It would also make it a bit easier to check manually that the script is checking for duplicates correctly.

Also, some suggestions:

+def testmethod_names(code, name=[]):

It might be clearer to use the name=None form.

+    test_files = [fn for fn in python_files if
+                  fn.startswith(os.path.join('Lib', 'test'))]

Are you getting the test files in test/ subdirectories of subpackages?  I think checking that the file name starts with "test_" might be sufficient to get all test files.

+    if name[-1].startswith('test_'):

I believe 'test' is the prefix that unittest uses.  I'm pretty sure we have some tests that don't start with 'test_'.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16079>
_______________________________________


More information about the Python-bugs-list mailing list