Issue 19398: test_trace fails with -S (original) (raw)

Created on 2013-10-25 19:43 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
emergency_patch_for_test_trace.patch vajrasky,2013-10-26 04:52 review
remove_extra_slash_from_sys_path.patch vajrasky,2013-10-26 06:05 review
remove_extra_slash_from_sys_path_v2.patch vajrasky,2013-11-02 04:35 review
remove_extra_slash_from_sys_path_v3.patch serhiy.storchaka,2016-11-10 10:16 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft,2017-03-31 16:36
Messages (7)
msg201286 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-25 19:43
$ ./python -S -m test test_trace [1/1] test_trace test test_trace failed -- Traceback (most recent call last): File "/home/antoine/cpython/default/Lib/test/test_trace.py", line 313, in test_coverage self.assertTrue("pprint.cover" in files) AssertionError: False is not true
msg201313 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-26 04:52
This is the "emergency" patch to solve this issue. The main issue is, [sky@localhost cpython]$ ./python -Sc "import sys; print(sys.path)" ['', '/usr/local/lib/python34.zip', '/home/sky/Code/python/programming_language/cpython/Lib/', '/home/sky/Code/python/programming_language/cpython/Lib/plat-linux', '/home/sky/Code/python/programming_language/cpython/build/lib.linux-x86_64-3.4-pydebug'] [sky@localhost cpython]$ ./python -c "import sys; print(sys.path)" ['', '/usr/local/lib/python34.zip', '/home/sky/Code/python/programming_language/cpython/Lib', '/home/sky/Code/python/programming_language/cpython/Lib/plat-linux', '/home/sky/Code/python/programming_language/cpython/build/lib.linux-x86_64-3.4-pydebug', '/home/sky/.local/lib/python3.4/site-packages'] Let me "zoom" it for you. [sky@localhost cpython]$ ./python -Sc "import sys; print(sys.path[2])" /home/sky/Code/python/programming_language/cpython/Lib/ [sky@localhost cpython]$ ./python -c "import sys; print(sys.path[2])" /home/sky/Code/python/programming_language/cpython/Lib The "extra" slash is the culprit. I need to investigate whether this is deliberate or not.
msg201314 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-26 06:05
I finally found the main culprit which puts extra '/' in my sys.path. The patch removed the extra '/' and also fixed this test automatically.
msg201947 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-11-01 22:39
The test should use the more specific assertXyz method: self.assertIn("pprint.cover", files) The error message would then be the more informative AssertionError: 'pprint.cover' not found in
msg201962 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-11-02 04:35
Attached the patch to accommodate Terry J. Reedy's request.
msg280500 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-10 10:16
The separator is needed if the relative path is not empty and the prefix doesn't end with the separator. This patch seems also fixes most problems of .
msg280572 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-11 10:12
New changeset db220f2df5a9 by Serhiy Storchaka in branch '3.5': Issue #19398: Extra slash no longer added to sys.path components in case of https://hg.python.org/cpython/rev/db220f2df5a9 New changeset 1a88baaed7a0 by Serhiy Storchaka in branch '3.6': Issue #19398: Extra slash no longer added to sys.path components in case of https://hg.python.org/cpython/rev/1a88baaed7a0 New changeset 82607e7c24c7 by Serhiy Storchaka in branch 'default': Issue #19398: Extra slash no longer added to sys.path components in case of https://hg.python.org/cpython/rev/82607e7c24c7 New changeset 237ef36fb1bb by Serhiy Storchaka in branch '2.7': Issue #19398: Extra slash no longer added to sys.path components in case of https://hg.python.org/cpython/rev/237ef36fb1bb
History
Date User Action Args
2022-04-11 14:57:52 admin set github: 63597
2017-03-31 16:36:09 dstufft set pull_requests: + <pull%5Frequest846>
2016-11-11 12:02:17 serhiy.storchaka set status: open -> closedresolution: fixedstage: resolved
2016-11-11 10:12:27 python-dev set nosy: + python-devmessages: +
2016-11-10 10:16:27 serhiy.storchaka set files: + remove_extra_slash_from_sys_path_v3.patchnosy: + serhiy.storchakaversions: + Python 3.5, Python 3.6, Python 3.7, - Python 3.4messages: + assignee: serhiy.storchaka
2016-10-04 02:51:52 tdsmith set nosy: + tdsmithversions: + Python 2.7
2013-11-02 04:35:56 vajrasky set files: + remove_extra_slash_from_sys_path_v2.patchmessages: +
2013-11-01 22:39:42 terry.reedy set nosy: + terry.reedymessages: +
2013-10-26 06:05:34 vajrasky set files: + remove_extra_slash_from_sys_path.patchmessages: +
2013-10-26 04:52:42 vajrasky set files: + emergency_patch_for_test_trace.patchnosy: + vajraskymessages: + keywords: + patch
2013-10-25 19:43:53 pitrou create