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

local.cwd doesn't work if cwd changes by non-plumbum means #207

Merged
merged 2 commits into from
Aug 2, 2015

Conversation

henryiii
Copy link
Collaborator

This patch makes the local.cwd the current working directory, not just the current working directory when Plumbum loaded, so code like this now works:

assert local.cwd == os.getcwd()
os.chdir('../plumbum')
assert local.cwd == os.getcwd()
os.chdir('../tests')
assert local.cwd == os.getcwd()

The cwd is now a descriptor in the local machine (and works from class or object access). Added a test similar to the lines above to verify that it works.

(Example of use case: This is a common problem when working with Plumbum in IPython and trying to use local.cwd to find files after changing the directory with cd.)

@henryiii henryiii added the Bug label Jul 31, 2015
@tomerfiliba
Copy link
Owner

Looks good. I'd just call _FunctionDescriptor a StaticProperty.

@henryiii
Copy link
Collaborator Author

henryiii commented Aug 1, 2015

Done. Moved it to lib.py, too.

tomerfiliba added a commit that referenced this pull request Aug 2, 2015
local.cwd doesn't work if cwd changes by non-plumbum means
@tomerfiliba tomerfiliba merged commit ef2c634 into tomerfiliba:master Aug 2, 2015
@henryiii henryiii modified the milestone: v1.5.1 Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants