diff -r c5fbacf79b1e Lib/test/test_pathlib.py --- a/Lib/test/test_pathlib.py Sat Jan 30 12:34:12 2016 +0200 +++ b/Lib/test/test_pathlib.py Sun Feb 07 13:31:42 2016 +0100 @@ -2048,7 +2048,9 @@ import pwd pwdent = pwd.getpwuid(os.getuid()) username = pwdent.pw_name - userhome = pwdent.pw_dir.rstrip('/') + userhome = pwdent.pw_dir + if userhome != '/': + userhome = userhome.rstrip('/') # find arbitrary different user (if exists) for pwdent in pwd.getpwall(): othername = pwdent.pw_name diff -r c5fbacf79b1e Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py Sat Jan 30 12:34:12 2016 +0200 +++ b/Lib/test/test_posixpath.py Sun Feb 07 13:31:42 2016 +0100 @@ -245,8 +245,10 @@ # expanduser should fall back to using the password database del env['HOME'] home = pwd.getpwuid(os.getuid()).pw_dir - # $HOME can end with a trailing /, so strip it (see #17809) - self.assertEqual(posixpath.expanduser("~"), home.rstrip("/")) + if home != '/': + # $HOME can end with a trailing /, so strip it (see #17809) + home = home.rstrip('/') + self.assertEqual(posixpath.expanduser("~"), home) def test_normpath(self): self.assertEqual(posixpath.normpath(""), ".")