summaryrefslogtreecommitdiff
path: root/Lib/test/test_site.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-09-18 11:28:51 +0300
committerGitHub <noreply@github.com>2018-09-18 11:28:51 +0300
commit0185f34ddcf07b78feb6ac666fbfd4615d26b028 (patch)
treea27f02f0095d5a7fb1fcbd539114b3a74fb4fcc7 /Lib/test/test_site.py
parent7bdf28265aa371b39f82dfc6562635801aff15a5 (diff)
downloadcpython-git-0185f34ddcf07b78feb6ac666fbfd4615d26b028.tar.gz
bpo-33721: Make some os.path functions and pathlib.Path methods be tolerant to invalid paths. (#7695)
Such functions as os.path.exists(), os.path.lexists(), os.path.isdir(), os.path.isfile(), os.path.islink(), and os.path.ismount() now return False instead of raising ValueError or its subclasses UnicodeEncodeError and UnicodeDecodeError for paths that contain characters or bytes unrepresentative at the OS level.
Diffstat (limited to 'Lib/test/test_site.py')
-rw-r--r--Lib/test/test_site.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index e3c9deebf0..742be1ec03 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -159,13 +159,11 @@ class HelperFunctionsTests(unittest.TestCase):
# Issue 5258
pth_dir, pth_fn = self.make_pth("abc\x00def\n")
with captured_stderr() as err_out:
- site.addpackage(pth_dir, pth_fn, set())
- self.assertRegex(err_out.getvalue(), "line 1")
- self.assertRegex(err_out.getvalue(),
- re.escape(os.path.join(pth_dir, pth_fn)))
- # XXX: ditto previous XXX comment.
- self.assertRegex(err_out.getvalue(), 'Traceback')
- self.assertRegex(err_out.getvalue(), 'ValueError')
+ self.assertFalse(site.addpackage(pth_dir, pth_fn, set()))
+ self.assertEqual(err_out.getvalue(), "")
+ for path in sys.path:
+ if isinstance(path, str):
+ self.assertNotIn("abc\x00def", path)
def test_addsitedir(self):
# Same tests for test_addpackage since addsitedir() essentially just