Merge lp:~lifeless/subunit/bug-353510 into lp:~subunit/subunit/trunk

Proposed by Robert Collins
Status: Merged
Merged at revision: not available
Proposed branch: lp:~lifeless/subunit/bug-353510
Merge into: lp:~subunit/subunit/trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~lifeless/subunit/bug-353510
Reviewer Review Type Date Requested Status
Subunit Developers Pending
Review via email: mp+8982@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Teach ExecTestCase how to pass args.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/subunit/__init__.py'
2--- python/subunit/__init__.py 2009-06-12 01:45:53 +0000
3+++ python/subunit/__init__.py 2009-07-18 03:43:05 +0000
4@@ -432,8 +432,8 @@
5
6 def _run(self, result):
7 protocol = TestProtocolServer(result)
8- output = subprocess.Popen([self.script],
9- stdout=subprocess.PIPE).communicate()[0]
10+ output = subprocess.Popen(self.script, shell=True,
11+ stdout=subprocess.PIPE).communicate()[0]
12 protocol.readFrom(StringIO(output))
13
14
15
16=== modified file 'python/subunit/tests/sample-script.py'
17--- python/subunit/tests/sample-script.py 2005-11-30 11:04:16 +0000
18+++ python/subunit/tests/sample-script.py 2009-07-18 03:43:05 +0000
19@@ -1,5 +1,9 @@
20 #!/usr/bin/env python
21 import sys
22+if len(sys.argv) == 2:
23+ print "test fail"
24+ print "error fail"
25+ sys.exit(0)
26 print "test old mcdonald"
27 print "success old mcdonald"
28 print "test bing crosby"
29
30=== modified file 'python/subunit/tests/test_test_protocol.py'
31--- python/subunit/tests/test_test_protocol.py 2009-02-28 09:27:25 +0000
32+++ python/subunit/tests/test_test_protocol.py 2009-07-18 03:43:05 +0000
33@@ -823,12 +823,21 @@
34 # the sample script runs three tests, one each
35 # that fails, errors and succeeds
36
37+ def test_sample_method_args(self):
38+ """sample-script.py foo"""
39+ # sample that will run just one test.
40
41 def test_construct(self):
42 test = self.SampleExecTestCase("test_sample_method")
43 self.assertEqual(test.script,
44 subunit.join_dir(__file__, 'sample-script.py'))
45
46+ def test_args(self):
47+ result = unittest.TestResult()
48+ test = self.SampleExecTestCase("test_sample_method_args")
49+ test.run(result)
50+ self.assertEqual(1, result.testsRun)
51+
52 def test_run(self):
53 runner = MockTestProtocolServerClient()
54 test = self.SampleExecTestCase("test_sample_method")

Subscribers

People subscribed via source and target branches