diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/__init__.py | 8 | ||||
| -rwxr-xr-x | python/subunit/tests/sample-script.py | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index a7048d3..82864f7 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -817,6 +817,8 @@ class ExecTestCase(unittest.TestCase): """ unittest.TestCase.__init__(self, methodName) testMethod = getattr(self, methodName) + # GZ 2011-04-25: Embedding shell commands in docstrings is fragile and + # and may break if the module directory contains spaces self.script = join_dir(sys.modules[self.__class__.__module__].__file__, testMethod.__doc__) @@ -833,8 +835,10 @@ class ExecTestCase(unittest.TestCase): def _run(self, result): protocol = TestProtocolServer(result) - output = subprocess.Popen(self.script, shell=True, - stdout=subprocess.PIPE).communicate()[0] + process = subprocess.Popen(self.script, shell=True, + stdout=subprocess.PIPE) + _make_stream_binary(process.stdout) + output = process.communicate()[0] protocol.readFrom(BytesIO(output)) diff --git a/python/subunit/tests/sample-script.py b/python/subunit/tests/sample-script.py index 0ee019a..618e495 100755 --- a/python/subunit/tests/sample-script.py +++ b/python/subunit/tests/sample-script.py @@ -1,5 +1,8 @@ #!/usr/bin/env python import sys +if sys.platform == "win32": + import msvcrt, os + msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) if len(sys.argv) == 2: # subunit.tests.test_test_protocol.TestExecTestCase.test_sample_method_args # uses this code path to be sure that the arguments were passed to |
