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

FAIL: test_expanduser when $HOME=/ #69138

Closed
felixonmars mannequin opened this issue Aug 28, 2015 · 8 comments
Closed

FAIL: test_expanduser when $HOME=/ #69138

felixonmars mannequin opened this issue Aug 28, 2015 · 8 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@felixonmars
Copy link
Mannequin

felixonmars mannequin commented Aug 28, 2015

BPO 24950
Nosy @pitrou, @serhiy-storchaka, @felixonmars
Files
  • issue24950.diff
  • 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-05-03.19:08:54.531>
    created_at = <Date 2015-08-28.03:28:26.201>
    labels = ['type-bug', 'tests']
    title = 'FAIL: test_expanduser when $HOME=/'
    updated_at = <Date 2016-05-03.19:08:54.530>
    user = 'https://github.com/felixonmars'

    bugs.python.org fields:

    activity = <Date 2016-05-03.19:08:54.530>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-05-03.19:08:54.531>
    closer = 'serhiy.storchaka'
    components = ['Tests']
    creation = <Date 2015-08-28.03:28:26.201>
    creator = 'felixonmars'
    dependencies = []
    files = ['41842']
    hgrepos = []
    issue_num = 24950
    keywords = ['patch']
    message_count = 8.0
    messages = ['249273', '249274', '258245', '259786', '259787', '259788', '264751', '264752']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'SilentGhost', 'python-dev', 'serhiy.storchaka', 'felixonmars']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue24950'
    versions = ['Python 3.5', 'Python 3.6']

    @felixonmars
    Copy link
    Mannequin Author

    felixonmars mannequin commented Aug 28, 2015

    test_expanduser in test.test_posixpath.PosixPathTest fails when the users $HOME being exactly "/", after the patch in bpo-17809 was introduced.

    test test_posixpath failed -- Traceback (most recent call last):
      File "/build/python/src/Python-3.5.0rc2/Lib/test/test_posixpath.py", line 249, in test_expanduser
        self.assertEqual(posixpath.expanduser("~"), home.rstrip("/"))
    AssertionError: '/' != ''
    - /
    +

    Would it be appropriate to apply the rstrip() also to the left part of the equation?

    @felixonmars felixonmars mannequin added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Aug 28, 2015
    @felixonmars felixonmars mannequin changed the title FAIL: test_expanduser when $HOME=/ FAIL: test_posixpath when $HOME=/ Aug 28, 2015
    @felixonmars felixonmars mannequin changed the title FAIL: test_posixpath when $HOME=/ FAIL: test_expanduser when $HOME=/ Aug 28, 2015
    @felixonmars
    Copy link
    Mannequin Author

    felixonmars mannequin commented Aug 28, 2015

    btw, there seems to be a relevant failure in test_pathlib as well:

    test test_pathlib failed -- Traceback (most recent call last):
      File "/build/python/src/Python-3.5.0rc2/Lib/test/test_pathlib.py", line 2015, in test_expanduser
        self.assertEqual(p1.expanduser(), P(userhome) / 'Documents')
    AssertionError: PosixPath('/Documents') != PosixPath('Documents')

    (not sure if they are really relevant, though)

    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Jan 14, 2016

    For posixpath the fix is straightforward: just skip that assert if the home ends up being '/' (the '/' is tested above).

    For pathlib, I'm not entirely sure what the fix should be.

    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Feb 7, 2016

    Here is the patch that addresses the issue in both tests. Felix, could you test it?

    @serhiy-storchaka
    Copy link
    Member

    What if HOME is "//"?

    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Feb 7, 2016

    What if HOME is "//"?

    Is this possible? What would be the result of these tests? Would they fail? As far as I understand my patch is just fixing problem introduced by fixes from bpo-17809.

    @serhiy-storchaka serhiy-storchaka self-assigned this May 3, 2016
    @serhiy-storchaka
    Copy link
    Member

    Yet one corner case is empty HOME value.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 3, 2016

    New changeset 194b356c84f5 by Serhiy Storchaka in branch '3.5':
    Issue bpo-24950: Fixed expanduser tests when the users home directory in pwd is "/".
    https://hg.python.org/cpython/rev/194b356c84f5

    New changeset b9b99cb85a5f by Serhiy Storchaka in branch 'default':
    Issue bpo-24950: Fixed expanduser tests when the users home directory in pwd is "/".
    https://hg.python.org/cpython/rev/b9b99cb85a5f

    @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
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant