Skip to content

Commit

Permalink
Merge pull request #142 from AntoineD/master
Browse files Browse the repository at this point in the history
fix issue #139
  • Loading branch information
tomerfiliba committed Aug 7, 2014
2 parents ceb240e + 88d4e3c commit b2be5a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion plumbum/path/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def __init__(self, *parts):
raise TypeError("LocalPath cannot be constructed from %r" % (parts,))
self._path = os.path.normpath(os.path.join(*(str(p) for p in parts)))
def __new__(cls, *parts):
if len(parts) == 1 and isinstance(parts[0], cls):
if len(parts) == 1 and \
isinstance(parts[0], cls) and \
not isinstance(parts[0], LocalWorkdir):
return parts[0]
return object.__new__(cls)
def __str__(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ def test_nesting_lists_as_argv(self):
def test_contains(self):
self.assertTrue("ls" in local, "Expected to find `ls`")


def test_issue_139(self):
LocalPath(local.cwd)

if __name__ == "__main__":
unittest.main()
Expand Down

0 comments on commit b2be5a2

Please sign in to comment.