[Python-checkins] bpo-45403: Fix test_sys.test_stdlib_dir() (GH-28785)

vstinner webhook-mailer at python.org
Thu Oct 7 15:22:34 EDT 2021


https://github.com/python/cpython/commit/768aaf6c433e6a13b82c7bdebd0062c7472c1fc7
commit: 768aaf6c433e6a13b82c7bdebd0062c7472c1fc7
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-10-07T21:22:28+02:00
summary:

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.

files:
A Misc/NEWS.d/next/Tests/2021-10-07-13-27-12.bpo-45403.7QiDvw.rst
M Lib/test/test_sys.py

diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index cf708407c2903..6720cd622d7c5 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 0000000000000..e4d1709960980
--- /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.



More information about the Python-checkins mailing list