diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index cf708407c290342..6720cd622d7c5b4 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -1001,8 +1001,8 @@ def test_stdlib_dir(self): 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 000000000000000..e4d170996098017 --- /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.