]> granicus.if.org Git - python/commitdiff
bpo-38234: Fix test_embed pathconfig tests (GH-16390)
authorVictor Stinner <vstinner@redhat.com>
Wed, 25 Sep 2019 14:30:36 +0000 (16:30 +0200)
committerGitHub <noreply@github.com>
Wed, 25 Sep 2019 14:30:36 +0000 (16:30 +0200)
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.

Lib/test/test_embed.py

index e7a10b6defea1bb495d061d4592bae947777f91c..ed90fc0cbed0cde365447bca3b7f8db33d3b0131 100644 (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