X-Git-Url: http://git.samba.org/samba.git/?p=third_party%2Fsubunit;a=blobdiff_plain;f=lib%2Fsubunit%2Ftests%2Ftest_test_protocol.py;fp=lib%2Fsubunit%2Ftests%2Ftest_test_protocol.py;h=914e82d2225b4234614434f6343a53097b9effb0;hp=7f1707cb38cf73266ae58731782a2e447c639c6e;hb=62631024e44dcc5180023ae25024577f0601b902;hpb=a5164f11ca33439618ef0c108a6ead06c9be65fd diff --git a/lib/subunit/tests/test_test_protocol.py b/lib/subunit/tests/test_test_protocol.py index 7f1707c..914e82d 100644 --- a/lib/subunit/tests/test_test_protocol.py +++ b/lib/subunit/tests/test_test_protocol.py @@ -115,6 +115,7 @@ class TestTestImports(unittest.TestCase): from subunit import TestProtocolServer from subunit import RemotedTestCase from subunit import RemoteError + from subunit import ExecTestCase class TestTestProtocolServerPipe(unittest.TestCase): @@ -552,6 +553,43 @@ class TestRemoteError(unittest.TestCase): def test_empty_constructor(self): self.assertEqual(subunit.RemoteError(), subunit.RemoteError("")) +class TestExecTestCase(unittest.TestCase): + + class SampleExecTestCase(subunit.ExecTestCase): + + def test_sample_method(self): + """./lib/subunit/tests/sample-script.py""" + # the sample script runs three tests, one each + # that fails, errors and succeeds + + + def test_construct(self): + test = self.SampleExecTestCase("test_sample_method") + self.assertEqual(test.script, "./lib/subunit/tests/sample-script.py") + + def test_run(self): + runner = MockTestProtocolServerClient() + test = self.SampleExecTestCase("test_sample_method") + test.run(runner) + mcdonald = subunit.RemotedTestCase("old mcdonald") + bing = subunit.RemotedTestCase("bing crosby") + an_error = subunit.RemotedTestCase("an error") + self.assertEqual(runner.error_calls, + [(an_error, subunit.RemoteError())]) + self.assertEqual(runner.failure_calls, + [(bing, + subunit.RemoteError( + "foo.c:53:ERROR invalid state\n"))]) + self.assertEqual(runner.start_calls, [mcdonald, bing, an_error]) + self.assertEqual(runner.end_calls, [mcdonald, bing, an_error]) + + def test_debug(self): + test = self.SampleExecTestCase("test_sample_method") + test.debug() + + def test_count_test_cases(self): + """TODO run the child process and count responses to determine the count.""" + def test_suite(): loader = subunit.tests.TestUtil.TestLoader() result = loader.loadTestsFromName(__name__)