Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_trace fails with -S #63597

Closed
pitrou opened this issue Oct 25, 2013 · 7 comments
Closed

test_trace fails with -S #63597

pitrou opened this issue Oct 25, 2013 · 7 comments
Assignees
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Oct 25, 2013

BPO 19398
Nosy @terryjreedy, @pitrou, @serhiy-storchaka, @vajrasky, @tdsmith
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • emergency_patch_for_test_trace.patch
  • remove_extra_slash_from_sys_path.patch
  • remove_extra_slash_from_sys_path_v2.patch
  • remove_extra_slash_from_sys_path_v3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-11-11.12:02:17.455>
    created_at = <Date 2013-10-25.19:43:53.096>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'test_trace fails with -S'
    updated_at = <Date 2017-03-31.16:36:09.121>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:09.121>
    actor = 'dstufft'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-11-11.12:02:17.455>
    closer = 'serhiy.storchaka'
    components = ['Tests']
    creation = <Date 2013-10-25.19:43:53.096>
    creator = 'pitrou'
    dependencies = []
    files = ['32366', '32367', '32460', '45422']
    hgrepos = []
    issue_num = 19398
    keywords = ['patch']
    message_count = 7.0
    messages = ['201286', '201313', '201314', '201947', '201962', '280500', '280572']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'pitrou', 'python-dev', 'serhiy.storchaka', 'vajrasky', 'tdsmith']
    pr_nums = ['552']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue19398'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 25, 2013

    $ ./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

    @pitrou pitrou added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Oct 25, 2013
    @vajrasky
    Copy link
    Mannequin

    vajrasky mannequin commented Oct 26, 2013

    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.

    @vajrasky
    Copy link
    Mannequin

    vajrasky mannequin commented Oct 26, 2013

    I finally found the main culprit which puts extra '/' in my sys.path. The patch removed the extra '/' and also fixed this test automatically.

    @terryjreedy
    Copy link
    Member

    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 <files listed>

    @vajrasky
    Copy link
    Mannequin

    vajrasky mannequin commented Nov 2, 2013

    Attached the patch to accommodate Terry J. Reedy's request.

    @serhiy-storchaka
    Copy link
    Member

    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 bpo-28655.

    @serhiy-storchaka serhiy-storchaka added the 3.7 (EOL) end of life label Nov 10, 2016
    @serhiy-storchaka serhiy-storchaka self-assigned this Nov 10, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 11, 2016

    New changeset db220f2df5a9 by Serhiy Storchaka in branch '3.5':
    Issue bpo-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 bpo-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 bpo-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 bpo-19398: Extra slash no longer added to sys.path components in case of
    https://hg.python.org/cpython/rev/237ef36fb1bb

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants