create a RemotedTestCase class
[third_party/subunit] / lib / subunit / tests / test_test_protocol.py
index 62c2e6fccd5afddc9b2c490fc7654bdfdee91ec4..44da5d01ea281023e569518bb5872f81eca22970 100644 (file)
@@ -83,10 +83,11 @@ class TestMockTestProtocolServer(unittest.TestCase):
         self.assertEqual(protocol.success_calls, [""])
         
 
-class TestTestProtocolServer(unittest.TestCase):
+class TestTestImports(unittest.TestCase):
     
     def test_imports(self):
         from subunit import TestProtocolServer
+        from subunit import RemotedTestCase
 
 
 class TestTestProtocolServerStartTest(unittest.TestCase):
@@ -419,6 +420,25 @@ class TestTestProtocolServerAddSuccess(unittest.TestCase):
         self.simple_success_keyword("successful:")
 
 
+class TestRemotedTestCase(unittest.TestCase):
+
+    def test_simple(self):
+        test = subunit.RemotedTestCase("A test description")
+        self.assertRaises(NotImplementedError, test.setUp)
+        self.assertRaises(NotImplementedError, test.tearDown)
+        self.assertEqual("A test description",
+                         test.shortDescription())
+        self.assertEqual("subunit.RemotedTestCase.A test description",
+                         test.id())
+        self.assertEqual("A test description (subunit.RemotedTestCase)", "%s" % test)
+        self.assertEqual("<subunit.RemotedTestCase description="
+                         "'A test description'>", "%r" % test)
+        result = unittest.TestResult()
+        test.run(result)
+        self.assertEqual([(test, "Cannot run RemotedTestCases.\n\n")], result.errors)
+        self.assertEqual(1, result.testsRun)
+
+
 def test_suite():
     loader = subunit.tests.TestUtil.TestLoader()
     result = loader.loadTestsFromName(__name__)