X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Funit%2Fcmd%2Ftest_NSBperf.py;h=e1b4da7fcbedf16d47a4e18a53035edeafcb19cb;hb=c305d24c1499a5aef51c05e94fc9737878548c75;hp=d63af4949bbcc14d2c8e69b02cc7541e4234a228;hpb=6871f03787d1161d086434d929f4dec6b352c265;p=yardstick.git diff --git a/tests/unit/cmd/test_NSBperf.py b/tests/unit/cmd/test_NSBperf.py index d63af4949..e1b4da7fc 100644 --- a/tests/unit/cmd/test_NSBperf.py +++ b/tests/unit/cmd/test_NSBperf.py @@ -25,11 +25,11 @@ from yardstick.cmd.NSBperf import YardstickNSCli from yardstick.cmd import NSBperf -@mock.patch('__builtin__.raw_input', return_value='0') +@mock.patch('six.moves.input', return_value='0') 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): @@ -40,7 +40,8 @@ class TestYardstickNSCli(unittest.TestCase): def test_generate_final_report(self): yardstick_ns_cli = YardstickNSCli() test_case = "tc_baremetal_rfc2544_ipv4_1flow_1518B.yaml" - subprocess.call(["touch", "/tmp/yardstick.out"]) + if os.path.isfile("/tmp/yardstick.out"): + os.remove('/tmp/yardstick.out') self.assertIsNone(yardstick_ns_cli.generate_final_report(test_case)) def test_generate_kpi_results(self): @@ -111,7 +112,7 @@ class TestYardstickNSCli(unittest.TestCase): def test_validate_input(self): yardstick_ns_cli = YardstickNSCli() self.assertEqual(1, yardstick_ns_cli.validate_input("", 4)) - NSBperf.raw_input = lambda _: 'yes' + NSBperf.input = lambda _: 'yes' self.assertEqual(1, yardstick_ns_cli.validate_input(5, 4)) subprocess.call = mock.Mock(return_value=0) self.assertEqual(0, yardstick_ns_cli.validate_input(2, 4))