]> granicus.if.org Git - python/commitdiff
Fix SF #763362, test_posixpath failed
authorNeal Norwitz <nnorwitz@gmail.com>
Tue, 1 Jul 2003 03:33:31 +0000 (03:33 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Tue, 1 Jul 2003 03:33:31 +0000 (03:33 +0000)
Don't check expanduser('~') if the home directory == the root directory
(ie, we are running as root).

Lib/test/test_posixpath.py

index 37e96286d86924332af57f754f6eecee144d200a..fcf2ef56c6e69dcfdf6ddd5842fdbd8fa357a8f9 100644 (file)
@@ -338,10 +338,12 @@ class PosixPathTest(unittest.TestCase):
             pass
         else:
             self.assert_(isinstance(posixpath.expanduser("~/"), basestring))
-            self.assertEqual(
-                posixpath.expanduser("~") + "/",
-                posixpath.expanduser("~/")
-            )
+            # if home directory == root directory, this test makes no sense
+            if posixpath.expanduser("~") != '/':
+                self.assertEqual(
+                    posixpath.expanduser("~") + "/",
+                    posixpath.expanduser("~/")
+                )
             self.assert_(isinstance(posixpath.expanduser("~root/"), basestring))
             self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring))