selftest.py: Use testtools TestCase class.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 4 Mar 2012 17:00:54 +0000 (18:00 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 4 Mar 2012 18:38:25 +0000 (19:38 +0100)
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Mar  4 19:38:25 CET 2012 on sn-devel-104

selftest/tests/__init__.py
selftest/tests/test_socket_wrapper.py
selftest/tests/test_target.py
selftest/tests/test_testlist.py

index 12bcf43..3de290c 100644 (file)
@@ -19,6 +19,8 @@
 
 """Tests for selftest."""
 
+from testtools import TestCase
+
 import unittest
 
 def test_suite():
index 1ebdf94..81fe5b6 100644 (file)
 
 """Tests for selftest/socket_wrapper."""
 
+from selftest.tests import TestCase
+
 from selftest import socket_wrapper
 
 import os
-import unittest
 
-class SocketWrapperTests(unittest.TestCase):
+class SocketWrapperTests(TestCase):
 
     def test_setup_pcap(self):
         socket_wrapper.setup_pcap("somefile")
index 139ed74..4cdc028 100644 (file)
@@ -29,7 +29,7 @@ from selftest.target import (
     UnsupportedEnvironment,
     )
 
-import unittest
+from selftest.tests import TestCase
 
 
 class DummyEnvironment(Environment):
@@ -53,7 +53,7 @@ class DummyTarget(Target):
         return DummyEnvironment(name, prefix)
 
 
-class NoneEnvironmentTests(unittest.TestCase):
+class NoneEnvironmentTests(TestCase):
 
     def setUp(self):
         super(NoneEnvironmentTests, self).setUp()
@@ -69,7 +69,7 @@ class NoneEnvironmentTests(unittest.TestCase):
         self.assertEquals("", self.env.get_log())
 
 
-class NoneTargetTests(unittest.TestCase):
+class NoneTargetTests(TestCase):
 
     def setUp(self):
         super(NoneTargetTests, self).setUp()
@@ -80,7 +80,7 @@ class NoneTargetTests(unittest.TestCase):
             "something", "prefx")
 
 
-class EnvironmentManagerTests(unittest.TestCase):
+class EnvironmentManagerTests(TestCase):
 
     def setUp(self):
         super(EnvironmentManagerTests, self).setUp()
index 4405e86..cd44d46 100644 (file)
@@ -19,6 +19,8 @@
 
 """Tests for selftest.testlist."""
 
+from selftest.tests import TestCase
+
 from selftest.testlist import (
     RestrictedTestManager,
     find_in_list,
@@ -28,10 +30,8 @@ from selftest.testlist import (
 
 from cStringIO import StringIO
 
-import unittest
-
 
-class FindInListTests(unittest.TestCase):
+class FindInListTests(TestCase):
 
     def test_empty(self):
         self.assertIs(None, find_in_list([], "foo.test"))
@@ -41,7 +41,7 @@ class FindInListTests(unittest.TestCase):
             find_in_list([("foo.*bar", "because")], "foo.bla.bar"))
 
 
-class ReadTestRegexesTests(unittest.TestCase):
+class ReadTestRegexesTests(TestCase):
 
     def test_comment(self):
         f = StringIO("# I am a comment\n # I am also a comment\n")
@@ -57,7 +57,7 @@ class ReadTestRegexesTests(unittest.TestCase):
             list(read_test_regexes(f)))
 
 
-class ReadTestlistTests(unittest.TestCase):
+class ReadTestlistTests(TestCase):
 
     def test_read_list(self):
         inf = StringIO("-- TEST --\nfoo\nbar\nbla\n")
@@ -75,7 +75,7 @@ class ReadTestlistTests(unittest.TestCase):
 
 
 
-class RestrictedTestManagerTests(unittest.TestCase):
+class RestrictedTestManagerTests(TestCase):
 
     def test_unused(self):
         mgr = RestrictedTestManager(["foo.bar"])