diff options
Diffstat (limited to 'python/subunit')
-rw-r--r-- | python/subunit/__init__.py | 4 | ||||
-rwxr-xr-x | python/subunit/tests/sample-script.py | 4 | ||||
-rw-r--r-- | python/subunit/tests/test_test_protocol.py | 9 |
3 files changed, 15 insertions, 2 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index 7d800a8..fb6c83e 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -432,8 +432,8 @@ class ExecTestCase(unittest.TestCase): def _run(self, result): protocol = TestProtocolServer(result) - output = subprocess.Popen([self.script], - stdout=subprocess.PIPE).communicate()[0] + output = subprocess.Popen(self.script, shell=True, + stdout=subprocess.PIPE).communicate()[0] protocol.readFrom(StringIO(output)) diff --git a/python/subunit/tests/sample-script.py b/python/subunit/tests/sample-script.py index 223d2f5..33e5cb2 100755 --- a/python/subunit/tests/sample-script.py +++ b/python/subunit/tests/sample-script.py @@ -1,5 +1,9 @@ #!/usr/bin/env python import sys +if len(sys.argv) == 2: + print "test fail" + print "error fail" + sys.exit(0) print "test old mcdonald" print "success old mcdonald" print "test bing crosby" diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index 80f91e1..ead0ac6 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -823,12 +823,21 @@ class TestExecTestCase(unittest.TestCase): # the sample script runs three tests, one each # that fails, errors and succeeds + def test_sample_method_args(self): + """sample-script.py foo""" + # sample that will run just one test. def test_construct(self): test = self.SampleExecTestCase("test_sample_method") self.assertEqual(test.script, subunit.join_dir(__file__, 'sample-script.py')) + def test_args(self): + result = unittest.TestResult() + test = self.SampleExecTestCase("test_sample_method_args") + test.run(result) + self.assertEqual(1, result.testsRun) + def test_run(self): runner = MockTestProtocolServerClient() test = self.SampleExecTestCase("test_sample_method") |