[issue16079] list duplicate test names with patchcheck

Xavier de Gaye report at bugs.python.org
Mon Oct 1 18:49:53 CEST 2012


Xavier de Gaye added the comment:

The attached script, named duplicate_code_names.py, takes a file
name list as argument and prints duplicate code names found in these
files ordered by function, class, method and nested class or
function.

The script output on the whole std lib (see the result in the
attached file std_lib_duplicates.txt):

$ time ./python Tools/scripts/duplicate_code_names.py $(find Lib -name "*py") > std_lib_duplicates.txt
Lib/test/badsyntax_future4.py: compile error: from __future__ imports must occur at the beginning of the file (badsyntax_future4.py, line 3)
Lib/test/badsyntax_future6.py: compile error: from __future__ imports must occur at the beginning of the file (badsyntax_future6.py, line 3)
Lib/test/badsyntax_future3.py: compile error: future feature rested_snopes is not defined (badsyntax_future3.py, line 3)
Lib/test/badsyntax_future9.py: compile error: not a chance (badsyntax_future9.py, line 3)
Lib/test/bad_coding.py: compile error: unknown encoding for 'Lib/test/bad_coding.py': uft-8
Lib/test/badsyntax_future8.py: compile error: future feature * is not defined (badsyntax_future8.py, line 3)
Lib/test/badsyntax_3131.py: compile error: invalid character in identifier (badsyntax_3131.py, line 2)
Lib/test/badsyntax_future7.py: compile error: from __future__ imports must occur at the beginning of the file (badsyntax_future7.py, line 3)
Lib/test/bad_coding2.py: compile error: encoding problem for 'Lib/test/bad_coding2.py': utf-8
Lib/test/badsyntax_pep3120.py: compile error: invalid or missing encoding declaration for 'Lib/test/badsyntax_pep3120.py'
Lib/test/badsyntax_future5.py: compile error: from __future__ imports must occur at the beginning of the file (badsyntax_future5.py, line 4)
Lib/lib2to3/tests/data/different_encoding.py: compile error: invalid syntax (different_encoding.py, line 3)
Lib/lib2to3/tests/data/py2_test_grammar.py: compile error: invalid token (py2_test_grammar.py, line 31)
Lib/lib2to3/tests/data/bom.py: compile error: invalid syntax (bom.py, line 2)
Lib/lib2to3/tests/data/crlf.py: compile error: invalid syntax (crlf.py, line 1)
Lib/__phello__.foo.py: __phello__.foo not a valid module name

real    6m14.854s
user    6m14.455s
sys     0m0.392s


FWIW running the same command with python 3.2 takes about 2.5
minutes instead of more than 6 minutes (importlib ?).

----------
Added file: http://bugs.python.org/file27375/duplicate_code_names.py

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


More information about the Python-bugs-list mailing list