diff options
| author | Martin <gzlist@googlemail.com> | 2011-04-27 02:25:24 +0100 |
|---|---|---|
| committer | Martin <gzlist@googlemail.com> | 2011-04-27 02:25:24 +0100 |
| commit | 5a28b540845585f07ec1f10b96305c77f63104dd (patch) | |
| tree | d85962660bbb286383d4e91431cab2ddfab07242 /python | |
| parent | 4b6abb5335d793f842abaab3121276c7737481a0 (diff) | |
| download | subunit-git-5a28b540845585f07ec1f10b96305c77f63104dd.tar.gz | |
Hack ExecTestCase and its tests to sort-of be portable fixing the remaing spew
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 |
