Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 168e73d

Browse files
committed
Fix SF #763362, test_posixpath failed
Don't check expanduser('~') if the home directory == the root directory (ie, we are running as root).
1 parent 0ccda1e commit 168e73d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Lib/test/test_posixpath.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,12 @@ def test_expanduser(self):
338338
pass
339339
else:
340340
self.assert_(isinstance(posixpath.expanduser("~/"), basestring))
341-
self.assertEqual(
342-
posixpath.expanduser("~") + "/",
343-
posixpath.expanduser("~/")
344-
)
341+
# if home directory == root directory, this test makes no sense
342+
if posixpath.expanduser("~") != '/':
343+
self.assertEqual(
344+
posixpath.expanduser("~") + "/",
345+
posixpath.expanduser("~/")
346+
)
345347
self.assert_(isinstance(posixpath.expanduser("~root/"), basestring))
346348
self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring))
347349

0 commit comments

Comments
 (0)