X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fframework.py;h=7633ca04d0bd3ecbafd6c7f99ac1d2bd30ac1493;hb=a45dc07c153c4dd350b02fd30de471bbdb838ac9;hp=e3cf68d4aa5e9c35e82237e85203afbb5cda4a2a;hpb=defde0f87067eb473660794cbd4a2da69fdd191d;p=vpp.git diff --git a/test/framework.py b/test/framework.py index e3cf68d4aa5..7633ca04d0b 100644 --- a/test/framework.py +++ b/test/framework.py @@ -40,6 +40,12 @@ if os.name == 'posix' and sys.version_info[0] < 3: else: import subprocess +# Python2/3 compatible +try: + input = raw_input +except NameError: + pass + PASS = 0 FAIL = 1 ERROR = 2 @@ -347,7 +353,7 @@ class VppTestCase(unittest.TestCase): print("Now is the time to attach a gdb by running the above " "command and set up breakpoints etc.") print(single_line_delim) - raw_input("Press ENTER to continue running the testcase...") + input("Press ENTER to continue running the testcase...") @classmethod def run_vpp(cls): @@ -487,8 +493,8 @@ class VppTestCase(unittest.TestCase): print(double_line_delim) print("VPP or GDB server is still running") print(single_line_delim) - raw_input("When done debugging, press ENTER to kill the " - "process and finish running the testcase...") + input("When done debugging, press ENTER to kill the " + "process and finish running the testcase...") # first signal that we want to stop the pump thread, then wake it up if hasattr(cls, 'pump_thread_stop_flag'): @@ -1002,6 +1008,11 @@ class VppTestCase(unittest.TestCase): return rx + def runTest(self): + """ unittest calls runTest when TestCase is instantiated without a + test case. Use case: Writing unittests against VppTestCase""" + pass + def get_testcase_doc_name(test): return getdoc(test.__class__).splitlines()[0]