diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -9,7 +9,6 @@
import sys
import time
import unittest
-import textwrap
from test import support
try:
import _posixsubprocess
@@ -219,15 +218,17 @@
self.assertEqual(_testcapi.argparsing("Hello", "World"), 1)
[email protected](
- sys.platform.startswith('win'),
- "interpreter embedding tests aren't built under Windows")
class EmbeddingTests(unittest.TestCase):
- # XXX only tested under Unix checkouts
-
def setUp(self):
basepath = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
- self.test_exe = exe = os.path.join(basepath, "Modules", "_testembed")
+ exename = "_testembed"
+ if sys.platform.startswith("win"):
+ ext = ("_d" if "_d" in sys.executable else "") + ".exe"
+ exename += ext
+ exepath = os.path.dirname(sys.executable)
+ else:
+ exepath = os.path.join(basepath, "Modules")
+ self.test_exe = exe = os.path.join(exepath, exename)
if not os.path.exists(exe):
self.skipTest("%r doesn't exist" % exe)
# This is needed otherwise we get a fatal error:
@@ -267,31 +268,31 @@
print()
print(out)
print(err)
- expected_output = textwrap.dedent("""\
- --- Use defaults ---
- Expected encoding: default
- Expected errors: default
- stdin: {0.__stdin__.encoding}:strict
- stdout: {0.__stdout__.encoding}:strict
- stderr: {0.__stderr__.encoding}:backslashreplace
- --- Set errors only ---
- Expected encoding: default
- Expected errors: surrogateescape
- stdin: {0.__stdin__.encoding}:surrogateescape
- stdout: {0.__stdout__.encoding}:surrogateescape
- stderr: {0.__stderr__.encoding}:backslashreplace
- --- Set encoding only ---
- Expected encoding: latin-1
- Expected errors: default
- stdin: latin-1:strict
- stdout: latin-1:strict
- stderr: latin-1:backslashreplace
- --- Set encoding and errors ---
- Expected encoding: latin-1
- Expected errors: surrogateescape
- stdin: latin-1:surrogateescape
- stdout: latin-1:surrogateescape
- stderr: latin-1:backslashreplace""").format(sys)
+ expected_output = os.linesep.join([
+ "--- Use defaults ---",
+ "Expected encoding: default",
+ "Expected errors: default",
+ "stdin: {0.__stdin__.encoding}:strict",
+ "stdout: {0.__stdout__.encoding}:strict",
+ "stderr: {0.__stderr__.encoding}:backslashreplace",
+ "--- Set errors only ---",
+ "Expected encoding: default",
+ "Expected errors: surrogateescape",
+ "stdin: {0.__stdin__.encoding}:surrogateescape",
+ "stdout: {0.__stdout__.encoding}:surrogateescape",
+ "stderr: {0.__stderr__.encoding}:backslashreplace",
+ "--- Set encoding only ---",
+ "Expected encoding: latin-1",
+ "Expected errors: default",
+ "stdin: latin-1:strict",
+ "stdout: latin-1:strict",
+ "stderr: latin-1:backslashreplace",
+ "--- Set encoding and errors ---",
+ "Expected encoding: latin-1",
+ "Expected errors: surrogateescape",
+ "stdin: latin-1:surrogateescape",
+ "stdout: latin-1:surrogateescape",
+ "stderr: latin-1:backslashreplace"]).format(sys)
# This is useful if we ever trip over odd platform behaviour
self.maxDiff = None
self.assertEqual(out.strip(), expected_output)
diff --git a/PCbuild/_testembed.vcxproj b/PCbuild/_testembed.vcxproj
new file mode 100644
--- /dev/null
+++ b/PCbuild/_testembed.vcxproj
@@ -0,0 +1,161 @@
+
+