From bb414974dc55f39f7a380d54eeb13438ea18cf19 Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Sat, 28 Jul 2018 14:49:27 +0100 Subject: [PATCH] bpo-34255: Ensure that test.test_embed works when blddir != srcdir This changes the way the _testembed command is located to ensure this helper is found when building outside of the source tree. --- Lib/test/test_embed.py | 8 ++++++-- .../next/Tests/2018-07-28-14-48-59.bpo-34255.AKSqSY.rst | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2018-07-28-14-48-59.bpo-34255.AKSqSY.rst diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index e00b1d8f481c772..add39e4e05f9c52 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -7,12 +7,16 @@ import re import subprocess import sys +import sysconfig class EmbeddingTestsMixin: def setUp(self): - here = os.path.abspath(__file__) - basepath = os.path.dirname(os.path.dirname(os.path.dirname(here))) + if not sysconfig.is_python_build(): + self.skipTest('testing installed tree') + + basepath = sysconfig._PROJECT_BASE + exename = "_testembed" if sys.platform.startswith("win"): ext = ("_d" if "_d" in sys.executable else "") + ".exe" diff --git a/Misc/NEWS.d/next/Tests/2018-07-28-14-48-59.bpo-34255.AKSqSY.rst b/Misc/NEWS.d/next/Tests/2018-07-28-14-48-59.bpo-34255.AKSqSY.rst new file mode 100644 index 000000000000000..394345b05f5bae9 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2018-07-28-14-48-59.bpo-34255.AKSqSY.rst @@ -0,0 +1 @@ +Ensure that test.test_embed works when building outside of the source tree