Issue 27185: Clarify Test Coverage for the String Module (test_pep292 is not easily discoverable) (original) (raw)

Created on 2016-06-02 17:54 by erinspace, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
stringtests.patch erinspace,2016-06-02 17:54 review
stringtests.patch erinspace,2016-06-02 19:42 review
Messages (25)
msg266902 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2016-06-02 18:28
Can you sign the Python contributor form - https://www.python.org/psf/contrib/contrib-form/? (If you already have, just say so.)
msg266905 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-02 18:33
string.Template is tested in Lib/test/test_pep292.py.
msg266906 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2016-06-02 18:36
Thanks Serhiy. Given that, I suggest checking if the new tests this adds are already covered in test_pep292.py or not to decide if we should move forward with this patch or not.
msg266915 - (view) Author: Erin Braswell (erinspace) * Date: 2016-06-02 18:59
Just checked! Apologies for this totally unnecessary patch, didn't know to look elsewhere but now I absolutely do -- looks like all the tests are there and more. Thank you!
msg266917 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-06-02 19:02
It probably makes sense to move test_pep292.py tests into test_string.py. Test files named after peps are not very helpful.
msg266920 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-02 19:05
Or at least add a reference in test_string.py.
msg266921 - (view) Author: Erin Braswell (erinspace) * Date: 2016-06-02 19:05
Oh! I can do that, and resubmit the patch! Good suggestion. Thank you again.
msg266930 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-06-02 19:25
Reopening and retitling.
msg266933 - (view) Author: Erin Braswell (erinspace) * Date: 2016-06-02 19:42
Here is an updated patch adding all the tests from test_pep292.py into test_string.py. After this happens test_pep292.py can be removed!
msg266935 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-02 19:50
This is not so easy. After adding all the tests from test_pep292.py into test_string.py and removing test_pep292.py we will lost all the history of test_pep292.py. Merging two files in Mercurial is not easy. I already did this and can do again if it is worth.
msg266938 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-06-02 19:52
I'm not too concerned about that. git can handle it well, which we will have soon. On Thu, Jun 2, 2016, at 12:50, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > This is not so easy. After adding all the tests from test_pep292.py into > test_string.py and removing test_pep292.py we will lost all the history > of test_pep292.py. Merging two files in Mercurial is not easy. I already > did this and can do again if it is worth. > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue27185> > _______________________________________
msg266944 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-06-02 20:54
Benjamin: meaning we should wait for git to merge it, or git will automatically handle the history after conversion?
msg266946 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-06-02 21:02
We should be able to commit it now. git blame can usually figure out this stuff post facto. On Thu, Jun 2, 2016, at 13:54, R. David Murray wrote: > > R. David Murray added the comment: > > Benjamin: meaning we should wait for git to merge it, or git will > automatically handle the history after conversion? > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue27185> > _______________________________________
msg266967 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-06-02 22:03
All right, I'll go ahead and commit it, then.
msg266990 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-02 23:39
New changeset 89abefdebf4d by R David Murray in branch '3.5': #27185: move test_pep292 into test_string. https://hg.python.org/cpython/rev/89abefdebf4d New changeset c2d3d8c3e0bf by R David Murray in branch 'default': Merge: #27185: move test_pep292 into test_string. https://hg.python.org/cpython/rev/c2d3d8c3e0bf
msg266991 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-06-02 23:41
Thanks, Erin.
msg266994 - (view) Author: Erin Braswell (erinspace) * Date: 2016-06-02 23:48
Hooray thank you everyone!
msg267018 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-03 01:28
FWIW I doubt Git is any better at this than Mercurial: <https://github.com/python/cpython/blame/master/Lib/test/test_string.py#L190> Git can automatically pick up file renames and copies when analysing the history, but has no special metadata for this. I understand Mercurial is the opposite (has metadata, but at least by default does not pick up copies and renames from the history). Perhaps that is what Benjamin was thinking of. I understand Git will only pick up movements of the majority of a file, not parts of files (unless something has changed recently). Perhaps Serhiy can clarify, but I imagine he was proposing something like this (which I have not tested): A. Start at revision A B. Remove test_string and rename test_pep292 in its place, giving revision B C. Merge revisions A and B, and manually merge the contents of the two test_string versions, giving the final revision
msg267036 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-03 04:56
This is even more complex, since you can't merge a revision with its parent. A. Start at revision A. B. Rename test_string to test_string_merged, giving revision B. A. Update back to revision A. C. Rename test_pep292 to test_string_merged, giving revision C. D. Merge revisions B and C, and manually merge the contents of the two test_string_merged versions, giving revision D. E. Rename test_string_merged to test_string, giving the final revision.
msg267043 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-06-03 05:31
On Thu, Jun 2, 2016, at 18:28, Martin Panter wrote: > > Martin Panter added the comment: > > FWIW I doubt Git is any better at this than Mercurial: > <https://github.com/python/cpython/blame/master/Lib/test/test_string.py#L190> > > Git can automatically pick up file renames and copies when analysing the > history, but has no special metadata for this. I understand Mercurial is > the opposite (has metadata, but at least by default does not pick up > copies and renames from the history). Perhaps that is what Benjamin was > thinking of. I understand Git will only pick up movements of the majority > of a file, not parts of files (unless something has changed recently). git blame -C works quite well in my experience for detecting moved lines of code. In general, I think we shouldn't be afraid to reorganize code for fear of breaking "VCS" history. The tools will catch up. (I think they largely have already.) At worst, one must manually "follow" the move of some code through history.
msg267058 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-03 06:39
New changeset 27f5eb630499 by Serhiy Storchaka in branch '2.7': Issue #27185: Rename test_string.py to test_string_merged.py. https://hg.python.org/cpython/rev/27f5eb630499 New changeset 8218b1309178 by Serhiy Storchaka in branch '2.7': Issue #27185: Rename test_pep292.py to test_string_merged.py. https://hg.python.org/cpython/rev/8218b1309178 New changeset 7dac80e0dd5e by Serhiy Storchaka in branch '2.7': Issue #27185: Merge test_pep292.py into test_string_merged.py. https://hg.python.org/cpython/rev/7dac80e0dd5e New changeset e2e309fb2b1e by Serhiy Storchaka in branch '2.7': Issue #27185: Rename test_string_merged.py back to test_string.py. https://hg.python.org/cpython/rev/e2e309fb2b1e
msg267060 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-03 06:47
Merged test_pep292.py into test_string.py with preserving the history in 2.7. This required following steps: hg mv Lib/test/test_string.py Lib/test/test_string_merged.py hg commit hg update -C -r -2 hg mv Lib/test/test_pep292.py Lib/test/test_string_merged.py hg commit hg update -C -r -2 hg merge # Manually merge the content of former test_string.py and test_pep292.py. hg commit hg mv Lib/test/test_string_merged.py Lib/test/test_string.py hg commit hg push We now should restore deleted test_pep292.py (is it possible with the history?) and repeat above steps in 3.x.
msg267071 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-03 07:23
IMO I wouldn’t bother. David has already done the change a different way, which is simpler to understand commit-by-commit, even if it messes with the Mercurial annotate history. FWIW I guess you could do a similar merge with an old version to restore the deleted file though.
msg267073 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-03 07:49
New changeset 70e19b014d2f by Serhiy Storchaka in branch '3.5': Issue #27185: Rename test_string.py to test_string_merged.py. https://hg.python.org/cpython/rev/70e19b014d2f New changeset 0da07e73451d by Serhiy Storchaka in branch '3.5': Issue #27185: Rename test_pep292.py to test_string_merged.py. https://hg.python.org/cpython/rev/0da07e73451d New changeset 14a036c696e8 by Serhiy Storchaka in branch '3.5': Issue #27185: Merge test_pep292.py into test_string_merged.py. https://hg.python.org/cpython/rev/14a036c696e8 New changeset 36f5229e45a6 by Serhiy Storchaka in branch '3.5': Issue #27185: Rename test_string_merged.py back to test_string.py. https://hg.python.org/cpython/rev/36f5229e45a6
msg267075 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-03 07:52
Now the history is restored.
History
Date User Action Args
2022-04-11 14:58:31 admin set github: 71372
2016-06-03 07:52:04 serhiy.storchaka set status: open -> closedresolution: fixedmessages: + stage: resolved
2016-06-03 07:49:08 python-dev set messages: +
2016-06-03 07:23:44 martin.panter set messages: + versions: + Python 2.7
2016-06-03 06:47:52 serhiy.storchaka set messages: +
2016-06-03 06:39:21 python-dev set messages: +
2016-06-03 05:31:42 benjamin.peterson set messages: +
2016-06-03 04:56:48 serhiy.storchaka set status: closed -> openresolution: fixed -> (no value)messages: + stage: resolved -> (no value)
2016-06-03 01:28:12 martin.panter set nosy: + martin.pantermessages: +
2016-06-02 23:48:21 erinspace set messages: +
2016-06-02 23:41:17 r.david.murray set status: open -> closedversions: + Python 3.5, Python 3.6messages: + resolution: fixedstage: resolved
2016-06-02 23:39:05 python-dev set nosy: + python-devmessages: +
2016-06-02 22:03:13 r.david.murray set messages: +
2016-06-02 21:02:27 benjamin.peterson set messages: +
2016-06-02 20:54:55 r.david.murray set messages: +
2016-06-02 19:52:46 benjamin.peterson set messages: +
2016-06-02 19:50:20 serhiy.storchaka set messages: +
2016-06-02 19:42:32 erinspace set files: + stringtests.patchmessages: +
2016-06-02 19:25:40 r.david.murray set status: closed -> opentitle: Increase Test Coverage for the String Module -> Clarify Test Coverage for the String Module (test_pep292 is not easily discoverable)nosy: + r.david.murraymessages: + resolution: duplicate -> (no value)
2016-06-02 19:05:51 erinspace set messages: +
2016-06-02 19:05:50 serhiy.storchaka set messages: +
2016-06-02 19:02:08 benjamin.peterson set nosy: + benjamin.petersonmessages: +
2016-06-02 18:59:38 erinspace set status: open -> closedresolution: duplicatemessages: +
2016-06-02 18:36:06 gregory.p.smith set messages: +
2016-06-02 18:33:41 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2016-06-02 18:28:25 gregory.p.smith set nosy: + gregory.p.smithmessages: +
2016-06-02 17:54:58 erinspace create