From: Victor Stinner Date: Thu, 7 Oct 2021 19:22:28 +0000 (+0200) Subject: bpo-45403: Fix test_sys.test_stdlib_dir() (GH-28785) X-Git-Tag: v3.11.0a2~278 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=768aaf6c433e6a13b82c7bdebd0062c7472c1fc7;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index cf708407c290..6720cd622d7c 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 000000000000..e4d170996098 --- /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.