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
Comments
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? |
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) |
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. |
Here is the patch that addresses the issue in both tests. Felix, could you test it? |
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. |
Yet one corner case is empty HOME value. |
New changeset 194b356c84f5 by Serhiy Storchaka in branch '3.5': New changeset b9b99cb85a5f by Serhiy Storchaka in branch 'default': |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: