classification
Title: shadowed test names in std lib regression tests
Type: behavior Stage: resolved
Components: Tests Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: berker.peksag, chris.jerdonek, ezio.melotti, michael.foord, pitrou, python-dev, xdegaye
Priority: normal Keywords: patch

Created on 2012-09-26 20:34 by xdegaye, last changed 2014-11-24 21:57 by berker.peksag. This issue is now closed.

Files
File name Uploaded Description Edit
find_duplicate_test_names.py xdegaye, 2012-09-26 20:34
duplicate_test_names.patch xdegaye, 2012-09-27 20:21 review
issue16056_27.diff berker.peksag, 2014-09-24 12:32
issue16056_27_v2.diff berker.peksag, 2014-11-02 12:00
Messages (13)
msg171361 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-09-26 20:34
The attached script, named find_duplicate_test_names.py, prints
duplicate regression test method names in a given directory tree.
Running this script on the standard library test suite shows few
duplicates, see below.  It means that some of those tests are not
run while they are probably meant to be.

Here is find_duplicate_test_names.py output on the default branch:

$ ./python find_duplicate_test_names.py Lib/test
Duplicate test method names:
Lib/test/test_types.py: <module>.ClassCreationTests.test_new_class_exec_body
Lib/test/test_heapq.py: <module>.TestErrorHandling.test_get_only
Lib/test/test_complex.py: <module>.ComplexTest.test_truediv
Lib/test/test_webbrowser.py: <module>.OperaCommandTest.test_open_new
Lib/test/test_dis.py: <module>.DisTests.test_big_linenos
Lib/test/test_dis.py: <module>.DisTests.test_dis_object
Lib/test/test_import.py: <module>.ImportTests.test_import_name_binding
Lib/test/test_email/test_email.py: <module>.TestQuopri.test_encode_one_long_line
Lib/test/test_email/test_email.py: <module>.TestLongHeaders.test_splitter_split_on_punctuation_only_if_fws
msg171362 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-09-26 20:49
Thanks a lot for the report.  Does the 2.7 branch have similar instances?
msg171369 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-09-27 08:01
Running find_duplicate_test_names.py (after changing the print
statements) on the 2.7 branch, gives the following output:

$ ./python find_duplicate_test_names.py Lib/test/
Duplicate test method names:
Lib/test/test_unicode.py: <module>.UnicodeTest.test_capitalize
Lib/test/test_iter.py: <module>.TestCase.test_unicode_join_endcase

The duplicate in Lib/test/test_iter.py is defined on purpose.
msg171370 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-09-27 08:39
The script could be actually be added somewhere (e.g. Tools/scripts) and run as part of `make patchcheck` on the test files that got changed.
msg171391 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-09-27 20:21
The attached patch uses the infrastructure of patchcheck.py and
merges the script into patchcheck.py instead of adding a new script.
msg171392 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-09-27 20:25
patchcheck output with the patch applied:

$ make patchcheck
./python ./Tools/scripts/patchcheck.py
Getting the list of files that have been added/changed ... 1 file
Fixing whitespace ... 0 files
Fixing C file whitespace ... 0 files
Fixing docs whitespace ... 0 files
Duplicate test names found in ... 1 file:
  Lib/test/test_heapq.py: test name 'TestErrorHandling.test_get_only'
Docs modified ... NO
Misc/ACKS updated ... NO
Misc/NEWS updated ... NO
configure regenerated ... not needed
pyconfig.h.in regenerated ... not needed

Did you run the test suite?
msg171396 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-09-27 22:10
New changeset e99c0425da59 by Benjamin Peterson in branch 'default':
renmae test method to avoid conflict (#16056)
http://hg.python.org/cpython/rev/e99c0425da59
msg171397 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-09-28 00:23
To simplify and keep the discussions more focused, etc, I would create a new issue for the patch to patchcheck (and mark it "enhancement").  Both issues can still reference each other.
msg171429 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-09-28 10:21
> To simplify and keep the discussions more focused, etc, I would
> create a new issue for the patch to patchcheck

New issue 16079 has been created.

The proposed patch in the new issue 16079 is slightly improved to
produce a cleaner output by printing the number of duplicate tests
and not the number of files where there are duplicates.
msg227445 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-24 12:03
New changeset 6d44906344f4 by Berker Peksag in branch '3.4':
Issue #16056: Rename test method in test_statistics to avoid conflict.
https://hg.python.org/cpython/rev/6d44906344f4

New changeset c49d7f4d1c04 by Berker Peksag in branch 'default':
Issue #16056: Rename test method in test_statistics to avoid conflict.
https://hg.python.org/cpython/rev/c49d7f4d1c04
msg227448 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-09-24 12:32
- issue 16079 opened for "make patchcheck" integration
- issue 19119 opened for test_heapq
- issue 19113 opened for test_functions

And here's a patch for 2.7.
msg230483 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-11-02 12:00
I think my patch is wrong.

test_weak_destroy_while_iterating and test_weak_destroy_and_mutate_while_iterating tests were committed as part of issue 7105 to 2.7 (see changeset https://hg.python.org/cpython/rev/03fcc12282fc). But, those same tests(they uses SomeClass instead of UserString) were also backported to 2.7 in https://hg.python.org/cpython/rev/04cc075bddf5

Here is a new patch.
msg231623 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-11-24 21:56
New changeset fd786e4e331c by Berker Peksag in branch '2.7':
Issue #16056: Rename test methods to avoid conflict.
https://hg.python.org/cpython/rev/fd786e4e331c
History
Date User Action Args
2014-11-24 21:57:44berker.peksagsetstatus: open -> closed
assignee: berker.peksag
resolution: fixed
stage: patch review -> resolved
2014-11-24 21:56:56python-devsetmessages: + msg231623
2014-11-02 12:00:41berker.peksagsetfiles: + issue16056_27_v2.diff
versions: - Python 3.4, Python 3.5
messages: + msg230483

components: + Tests, - Library (Lib)
stage: commit review -> patch review
2014-11-01 22:05:36ezio.melottisetstage: patch review -> commit review
2014-09-24 12:32:50berker.peksagsetfiles: + issue16056_27.diff
versions: + Python 3.4, Python 3.5, - Python 3.2, Python 3.3
nosy: + berker.peksag

messages: + msg227448

stage: needs patch -> patch review
2014-09-24 12:03:57python-devsetmessages: + msg227445
2012-09-28 10:21:26xdegayesetmessages: + msg171429
2012-09-28 00:23:48chris.jerdoneksetmessages: + msg171397
2012-09-27 22:10:24python-devsetnosy: + python-dev
messages: + msg171396
2012-09-27 20:25:53xdegayesetmessages: + msg171392
2012-09-27 20:21:17xdegayesetfiles: + duplicate_test_names.patch
keywords: + patch
messages: + msg171391
2012-09-27 08:39:13ezio.melottisetmessages: + msg171370
2012-09-27 08:04:44chris.jerdoneksetstage: needs patch
versions: + Python 3.2
2012-09-27 08:01:00xdegayesetmessages: + msg171369
versions: + Python 2.7
2012-09-26 20:49:44chris.jerdoneksetnosy: + pitrou, ezio.melotti, michael.foord
messages: + msg171362
2012-09-26 20:44:50chris.jerdoneksetnosy: + chris.jerdonek
2012-09-26 20:34:17xdegayecreate