From 6bf43e2393dc7df5efa6bf06039c1a53a07e6d87 Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Sun, 6 Sep 2015 11:06:55 +0200 Subject: [PATCH] Kill in a try finally clause --- run_tests.py | 24 +++++++++---------- .../test_add_community.py | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/run_tests.py b/run_tests.py index 8cb0485c..fcd27d1b 100644 --- a/run_tests.py +++ b/run_tests.py @@ -13,18 +13,18 @@ time.sleep(2) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))) - -print("Run") -runner = unittest.TextTestRunner().run(unittest.defaultTestLoader.discover(start_dir='cutecoin.tests', pattern='test_*')) -print("Terminate") -os.kill(p.pid, signal.SIGINT) -time.sleep(2) - try: - os.kill(p.pid, signal.SIGKILL) - p.kill() - print("Hard killed") -except OSError: - print("Terminated gracefully") + print("Run") + runner = unittest.TextTestRunner().run(unittest.defaultTestLoader.discover(start_dir='cutecoin.tests', pattern='test_*')) +finally: + print("Terminate") + os.kill(p.pid, signal.SIGINT) + time.sleep(2) + try: + os.kill(p.pid, signal.SIGKILL) + p.kill() + print("Hard killed") + except OSError: + print("Terminated gracefully") sys.exit(not runner.wasSuccessful()) \ No newline at end of file diff --git a/src/cutecoin/tests/process_cfg_community/test_add_community.py b/src/cutecoin/tests/process_cfg_community/test_add_community.py index 97a83f98..2fe1b1c4 100644 --- a/src/cutecoin/tests/process_cfg_community/test_add_community.py +++ b/src/cutecoin/tests/process_cfg_community/test_add_community.py @@ -62,7 +62,7 @@ class ProcessAddCommunity(unittest.TestCase): process_community.spinbox_port.setValue(50000) self.assertEqual(process_community.stacked_pages.currentWidget(), process_community.page_node, - msg="Current widget : {0}".format(process_community.stacked_pages.currentWidget().name())) + msg="Current widget : {0}".format(process_community.stacked_pages.currentWidget().objectName())) self.assertEqual(process_community.lineedit_server.text(), "127.0.0.1") self.assertEqual(process_community.spinbox_port.value(), 50000) QTest.mouseClick(process_community.button_register, Qt.LeftButton) @@ -84,7 +84,7 @@ class ProcessAddCommunity(unittest.TestCase): self.assertEqual(process_community.stacked_pages.currentWidget(), process_community.page_add_nodes, - msg="Current widget : {0}".format(process_community.stacked_pages.currentWidget().name())) + msg="Current widget : {0}".format(process_community.stacked_pages.currentWidget().objectName())) QTest.mouseClick(process_community.button_next, Qt.LeftButton) asyncio.async(exec_test()) -- GitLab