-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
Using tilde (~) #137
Comments
In the meanwhile, I found this workaround from os.path import expanduser
def test_gitignore_global_file(File):
path = expanduser('~/.gitignore_global')
gitignore_global = File(path)
assert gitignore_global.exists |
Hi, thanks for reporting. I think there is a bug here and the behavior could be different given the undelying backend or options (like sudo). |
Python does not expand ~ by default. For that matter, only shells do. likewise by default Python will not expand '$HOME/.gitignore_global' which is valid to the shell and in many cases equivalent to the example given. Should the File() module call both expanduser and expandvars from os.path? |
Using expanduser cannot work on remote connections (ssh, docker etc). This must be done by the shell. |
I had the same problem. My current workaround that works on remote connections looks like this: import os
def test_gitignore_global_file(File, User):
gitignore_global = File(os.path.join(User().home, '.gitignore_global'))
assert gitignore_global.exists But I think it makes the tests unneccesarily verbose. It would be nice if there was a shortcut for home-local paths. |
The following test fails
This one succeeds
In order to make the test succeed I have to use
/Users/me
instead of tilde.Is it correct?
The text was updated successfully, but these errors were encountered: