bpo-38234: Fix test_embed pathconfig tests (GH-16390)

bpo-38234: On macOS and FreeBSD, the temporary directory can be
symbolic link. For example, /tmp can be a symbolic link to /var/tmp.
Call realpath() to resolve all symbolic links.
This commit is contained in:
Victor Stinner 2019-09-25 16:30:36 +02:00 committed by GitHub
parent c64a1a61e6
commit 00508a7407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1042,6 +1042,11 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
def tmpdir_with_python(self):
# Temporary directory with a copy of the Python program
with tempfile.TemporaryDirectory() as tmpdir:
# bpo-38234: On macOS and FreeBSD, the temporary directory
# can be symbolic link. For example, /tmp can be a symbolic link
# to /var/tmp. Call realpath() to resolve all symbolic links.
tmpdir = os.path.realpath(tmpdir)
if MS_WINDOWS:
# Copy pythonXY.dll (or pythonXY_d.dll)
ver = sys.version_info