aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-07-13 03:19:54 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-13 03:19:54 +0000
commit96c151654bd4bd0fe469c11567f4d26b3d1e8dd2 (patch)
treefbf565e060f87bdf0e7d8a0d3885e6ab537bc709
parentf83729d38eb396fe5a94be13a86865f9cd26d0f4 (diff)
parent4eca49e30eb08becae65377bba8aa244a78c3eb5 (diff)
Merge "NSBperf: fix bad sigint handler"
-rw-r--r--tests/unit/cmd/test_NSBperf.py2
-rwxr-xr-xyardstick/cmd/NSBperf.py5
2 files changed, 3 insertions, 4 deletions
diff --git a/tests/unit/cmd/test_NSBperf.py b/tests/unit/cmd/test_NSBperf.py
index 5bd248a84..e1b4da7fc 100644
--- a/tests/unit/cmd/test_NSBperf.py
+++ b/tests/unit/cmd/test_NSBperf.py
@@ -29,7 +29,7 @@ from yardstick.cmd import NSBperf
class TestHandler(unittest.TestCase):
def test_handler(self, test):
subprocess.call = mock.Mock(return_value=0)
- self.assertRaises(SystemExit, NSBperf.handler)
+ self.assertRaises(SystemExit, NSBperf.sigint_handler)
class TestYardstickNSCli(unittest.TestCase):
diff --git a/yardstick/cmd/NSBperf.py b/yardstick/cmd/NSBperf.py
index f158d57f4..011990a3d 100755
--- a/yardstick/cmd/NSBperf.py
+++ b/yardstick/cmd/NSBperf.py
@@ -39,13 +39,11 @@ if not PYTHONPATH or not VIRTUAL_ENV:
raise SystemExit(1)
-def handler():
+def sigint_handler(*args, **kwargs):
""" Capture ctrl+c and exit cli """
subprocess.call(["pkill", "-9", "yardstick"])
raise SystemExit(1)
-signal.signal(signal.SIGINT, handler)
-
class YardstickNSCli(object):
""" This class handles yardstick network serivce testing """
@@ -214,5 +212,6 @@ class YardstickNSCli(object):
self.run_test(args, test_path)
if __name__ == "__main__":
+ signal.signal(signal.SIGINT, sigint_handler)
NS_CLI = YardstickNSCli()
NS_CLI.main()