]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45403: Fix test_sys.test_stdlib_dir() (GH-28785)
authorVictor Stinner <vstinner@python.org>
Thu, 7 Oct 2021 19:22:28 +0000 (21:22 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Oct 2021 19:22:28 +0000 (21:22 +0200)
Fix test_sys.test_stdlib_dir() when Python is built outside the
source tree: compare normalized paths.

Lib/test/test_sys.py
Misc/NEWS.d/next/Tests/2021-10-07-13-27-12.bpo-45403.7QiDvw.rst [new file with mode: 0644]

index cf708407c290342888ceec05ef7fae0a5bebb750..6720cd622d7c5b47ce2159b3cebefd820f6ccf63 100644 (file)
@@ -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 (file)
index 0000000..e4d1709
--- /dev/null
@@ -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.