You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a patch that builds _testembed on Windows and adjusts test_capi to not skip EmbeddingTests on Windows. The .vcxproj is based on _freeze_importlib, with "when to build" settings lifted from _testimportmultiple.
The patch also adjusts test_capi.EmbeddingTests.test_forced_io_encoding such that it doesn't blow up completely on Windows (and should still pass anywhere it does currently, though I haven't been able to test anywhere but on Windows yet). The test still fails, though; here's the relevant output I get:
Nice! I wonder if there might a difference between the default console
encoding and the default pipe encoding (that test assumes the default
standard stream encodings will be the same in the current process as they
are in the child).
"""
P:\Projects\OSS\Python\cpython\ $ chcp
Active code page: 437
P:\Projects\OSS\Python\cpython\ $ PCbuild\python_d.exe
Python 3.4.0a4+ (default:995173ed248a+, Nov 1 2013, 09:12:43) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, sys
>>> rfd, wfd = os.pipe()
>>> r = os.fdopen(rfd, 'r')
>>> w = os.fdopen(wfd, 'w')
>>> sys.stdin.encoding, sys.stdout.encoding
('cp437', 'cp437')
>>> r.encoding, w.encoding
('cp1252', 'cp1252')
"""
The test passes as patched if I do 'chcp 1252' before running. Is it reasonable to patch the test to expect the default stdout and stderr encoding to equal os.fdopen(os.pipe[1], 'w').encoding? Doing so passes on Windows, don't know about various Unixes.
Activity
zware commentedon Oct 29, 2013
Here's a patch that builds _testembed on Windows and adjusts test_capi to not skip EmbeddingTests on Windows. The .vcxproj is based on _freeze_importlib, with "when to build" settings lifted from _testimportmultiple.
The patch also adjusts test_capi.EmbeddingTests.test_forced_io_encoding such that it doesn't blow up completely on Windows (and should still pass anywhere it does currently, though I haven't been able to test anywhere but on Windows yet). The test still fails, though; here's the relevant output I get:
"""
======================================================================
FAIL: test_forced_io_encoding (test.test_capi.EmbeddingTests)
----------------------------------------------------------------------
Expected encoding: default
Expected errors: default
stdin: cp437:strict
? ^^^^
+ stdout: cp437:strict
? ^^^
? ^^^^
+ stderr: cp437:backslashreplace
? ^^^
--- Set errors only ---
Expected encoding: default
Expected errors: surrogateescape
stdin: cp437:surrogateescape
? ^^^^
+ stdout: cp437:surrogateescape
? ^^^
? ^^^^
+ stderr: cp437: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
----------------------------------------------------------------------
"""
I'm not sure whether this is a bug in the way _testembed is built or otherwise. EmbeddingTests.test_subinterps passes, though.
Due to my ongoing inability to get a 64-bit build to work, this has only been tested on 32-bit Windows 7.
ncoghlan commentedon Oct 29, 2013
Nice! I wonder if there might a difference between the default console
encoding and the default pipe encoding (that test assumes the default
standard stream encodings will be the same in the current process as they
are in the child).
zware commentedon Nov 1, 2013
That appears to be the case:
"""
P:\Projects\OSS\Python\cpython\ $ chcp
Active code page: 437
The test passes as patched if I do 'chcp 1252' before running. Is it reasonable to patch the test to expect the default stdout and stderr encoding to equal
os.fdopen(os.pipe[1], 'w').encoding? Doing so passes on Windows, don't know about various Unixes.zware commentedon Nov 3, 2013
This patch's changes to test_capi seem to work for Windows and keeps at least Gentoo and FreeBSD 10 happy.
python-dev commentedon Nov 3, 2013
New changeset c8c6c007ade3 by Nick Coghlan in branch 'default':
Close bpo-19439: execute embedding tests on Windows
http://hg.python.org/cpython/rev/c8c6c007ade3
ncoghlan commentedon Nov 3, 2013
I checked that test_capi still passed on Fedora as well.
Only tweak I made before committing was to ensure that the read end of the test pipe used to determine the default pipe encoding was also closed.
python-dev commentedon Nov 6, 2013
New changeset 99640494ca7f by Zachary Ware in branch 'default':
bpo-19439: Update PCbuild/readme.txt with new sub-project
http://hg.python.org/cpython/rev/99640494ca7f