summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-06-17 16:24:17 (GMT)
committerGitHub <noreply@github.com>2022-06-17 16:24:17 (GMT)
commit96464e5401783c99f1ae24369bb2a854b8c5f46a (patch)
tree8e11651d47b30698a8043e34f66305f6114d6c4c
parent11190c4ad0d3722b8d263758ac802985131a5462 (diff)
downloadcpython-96464e5401783c99f1ae24369bb2a854b8c5f46a.zip
cpython-96464e5401783c99f1ae24369bb2a854b8c5f46a.tar.gz
cpython-96464e5401783c99f1ae24369bb2a854b8c5f46a.tar.bz2
GH-89858: Fix test_embed for out-of-tree builds (GH-93465)
-rw-r--r--Lib/test/test_embed.py9
-rw-r--r--Misc/NEWS.d/next/Tests/2022-06-03-12-22-44.gh-issue-89858.ftBvjE.rst1
2 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index b2a1eba3..c7e5663 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -67,18 +67,16 @@ class EmbeddingTestsMixin:
ext = ("_d" if debug_build(sys.executable) else "") + ".exe"
exename += ext
exepath = builddir
- expecteddir = os.path.join(support.REPO_ROOT, builddir)
else:
exepath = os.path.join(builddir, 'Programs')
- expecteddir = os.path.join(support.REPO_ROOT, 'Programs')
self.test_exe = exe = os.path.join(exepath, exename)
- if exepath != expecteddir or not os.path.exists(exe):
+ if not os.path.exists(exe):
self.skipTest("%r doesn't exist" % exe)
# This is needed otherwise we get a fatal error:
# "Py_Initialize: Unable to get the locale encoding
# LookupError: no codec search functions registered: can't find encoding"
self.oldcwd = os.getcwd()
- os.chdir(support.REPO_ROOT)
+ os.chdir(builddir)
def tearDown(self):
os.chdir(self.oldcwd)
@@ -1375,10 +1373,11 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
with self.tmpdir_with_python() as tmpdir:
# pybuilddir.txt is a sub-directory relative to the current
# directory (tmpdir)
+ vpath = sysconfig.get_config_var("VPATH") or ''
subdir = 'libdir'
libdir = os.path.join(tmpdir, subdir)
# The stdlib dir is dirname(executable) + VPATH + 'Lib'
- stdlibdir = os.path.join(tmpdir, 'Lib')
+ stdlibdir = os.path.normpath(os.path.join(tmpdir, vpath, 'Lib'))
os.mkdir(libdir)
filename = os.path.join(tmpdir, 'pybuilddir.txt')
diff --git a/Misc/NEWS.d/next/Tests/2022-06-03-12-22-44.gh-issue-89858.ftBvjE.rst b/Misc/NEWS.d/next/Tests/2022-06-03-12-22-44.gh-issue-89858.ftBvjE.rst
new file mode 100644
index 0000000..ef806a9
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2022-06-03-12-22-44.gh-issue-89858.ftBvjE.rst
@@ -0,0 +1 @@
+Fix ``test_embed`` for out-of-tree builds. Patch by Kumar Aditya.