From 768aaf6c433e6a13b82c7bdebd0062c7472c1fc7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Oct 2021 21:22:28 +0200 Subject: bpo-45403: Fix test_sys.test_stdlib_dir() (GH-28785) Fix test_sys.test_stdlib_dir() when Python is built outside the source tree: compare normalized paths. --- Lib/test/test_sys.py | 4 ++-- Misc/NEWS.d/next/Tests/2021-10-07-13-27-12.bpo-45403.7QiDvw.rst | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2021-10-07-13-27-12.bpo-45403.7QiDvw.rst diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index cf70840..6720cd6 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -1001,8 +1001,8 @@ class SysModuleTest(unittest.TestCase): if marker and not os.path.exists(marker): marker = None expected = os.path.dirname(marker) if marker else None - actual = sys._stdlib_dir - self.assertEqual(actual, expected) + self.assertEqual(os.path.normpath(sys._stdlib_dir), + os.path.normpath(expected)) @test.support.cpython_only diff --git a/Misc/NEWS.d/next/Tests/2021-10-07-13-27-12.bpo-45403.7QiDvw.rst b/Misc/NEWS.d/next/Tests/2021-10-07-13-27-12.bpo-45403.7QiDvw.rst new file mode 100644 index 0000000..e4d1709 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2021-10-07-13-27-12.bpo-45403.7QiDvw.rst @@ -0,0 +1,2 @@ +Fix test_sys.test_stdlib_dir() when Python is built outside the source tree: +compare normalized paths. Patch by Victor Stinner. -- cgit v0.12