do not attempt to execute base tests
The OF 1.3 match.MatchTest class was intended to just be a base class, but
since it inherits from unittest.TestCase it was being run as a test.
This change ignores test classes that don't include a runTest field.
diff --git a/oft b/oft
index 4ca4d64..28de9f7 100755
--- a/oft
+++ b/oft
@@ -270,7 +270,8 @@
# Find all testcases defined in the module
tests = dict((k, v) for (k, v) in mod.__dict__.items() if type(v) == type and
- issubclass(v, unittest.TestCase))
+ issubclass(v, unittest.TestCase) and
+ hasattr(v, "runTest"))
if tests:
for (testname, test) in tests.items():
# Set default annotation values
diff --git a/src/python/oftest/base_tests.py b/src/python/oftest/base_tests.py
index 9d905f9..a1eec43 100644
--- a/src/python/oftest/base_tests.py
+++ b/src/python/oftest/base_tests.py
@@ -78,12 +78,6 @@
self.controller.join()
del self.controller
- def runTest(self):
- # Just a simple sanity check as illustration
- logging.info("Running simple proto test")
- self.assertTrue(self.controller.switch_socket is not None,
- str(self) + 'No connection to switch')
-
def assertTrue(self, cond, msg):
if not cond:
logging.error("** FAILED ASSERTION: " + msg)
@@ -112,12 +106,6 @@
SimpleProtocol.tearDown(self)
logging.info("Teardown done")
- def runTest(self):
- self.assertTrue(self.controller.switch_socket is not None,
- str(self) + 'No connection to switch')
- # self.dataplane.show()
- # Would like an assert that checks the data plane
-
class DataPlaneOnly(unittest.TestCase):
"""
Root class that sets up only the dataplane
@@ -131,8 +119,3 @@
def tearDown(self):
logging.info("Teardown for simple dataplane test")
logging.info("Teardown done")
-
- def runTest(self):
- logging.info("DataPlaneOnly")
- # self.dataplane.show()
- # Would like an assert that checks the data plane