Skip to content

Commit 96464e5

Browse files
GH-89858: Fix test_embed for out-of-tree builds (GH-93465)
1 parent 11190c4 commit 96464e5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Lib/test/test_embed.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,16 @@ def setUp(self):
6767
ext = ("_d" if debug_build(sys.executable) else "") + ".exe"
6868
exename += ext
6969
exepath = builddir
70-
expecteddir = os.path.join(support.REPO_ROOT, builddir)
7170
else:
7271
exepath = os.path.join(builddir, 'Programs')
73-
expecteddir = os.path.join(support.REPO_ROOT, 'Programs')
7472
self.test_exe = exe = os.path.join(exepath, exename)
75-
if exepath != expecteddir or not os.path.exists(exe):
73+
if not os.path.exists(exe):
7674
self.skipTest("%r doesn't exist" % exe)
7775
# This is needed otherwise we get a fatal error:
7876
# "Py_Initialize: Unable to get the locale encoding
7977
# LookupError: no codec search functions registered: can't find encoding"
8078
self.oldcwd = os.getcwd()
81-
os.chdir(support.REPO_ROOT)
79+
os.chdir(builddir)
8280

8381
def tearDown(self):
8482
os.chdir(self.oldcwd)
@@ -1375,10 +1373,11 @@ def test_init_pybuilddir(self):
13751373
with self.tmpdir_with_python() as tmpdir:
13761374
# pybuilddir.txt is a sub-directory relative to the current
13771375
# directory (tmpdir)
1376+
vpath = sysconfig.get_config_var("VPATH") or ''
13781377
subdir = 'libdir'
13791378
libdir = os.path.join(tmpdir, subdir)
13801379
# The stdlib dir is dirname(executable) + VPATH + 'Lib'
1381-
stdlibdir = os.path.join(tmpdir, 'Lib')
1380+
stdlibdir = os.path.normpath(os.path.join(tmpdir, vpath, 'Lib'))
13821381
os.mkdir(libdir)
13831382

13841383
filename = os.path.join(tmpdir, 'pybuilddir.txt')
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``test_embed`` for out-of-tree builds. Patch by Kumar Aditya.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy