Skip to content
Snippets Groups Projects
Commit 6bf43e23 authored by inso's avatar inso
Browse files

Kill in a try finally clause

parent 4fd3df8d
No related branches found
No related tags found
No related merge requests found
...@@ -13,18 +13,18 @@ time.sleep(2) ...@@ -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__), 'lib')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))) 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: try:
os.kill(p.pid, signal.SIGKILL) print("Run")
p.kill() runner = unittest.TextTestRunner().run(unittest.defaultTestLoader.discover(start_dir='cutecoin.tests', pattern='test_*'))
print("Hard killed") finally:
except OSError: print("Terminate")
print("Terminated gracefully") 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()) sys.exit(not runner.wasSuccessful())
\ No newline at end of file
...@@ -62,7 +62,7 @@ class ProcessAddCommunity(unittest.TestCase): ...@@ -62,7 +62,7 @@ class ProcessAddCommunity(unittest.TestCase):
process_community.spinbox_port.setValue(50000) process_community.spinbox_port.setValue(50000)
self.assertEqual(process_community.stacked_pages.currentWidget(), self.assertEqual(process_community.stacked_pages.currentWidget(),
process_community.page_node, 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.lineedit_server.text(), "127.0.0.1")
self.assertEqual(process_community.spinbox_port.value(), 50000) self.assertEqual(process_community.spinbox_port.value(), 50000)
QTest.mouseClick(process_community.button_register, Qt.LeftButton) QTest.mouseClick(process_community.button_register, Qt.LeftButton)
...@@ -84,7 +84,7 @@ class ProcessAddCommunity(unittest.TestCase): ...@@ -84,7 +84,7 @@ class ProcessAddCommunity(unittest.TestCase):
self.assertEqual(process_community.stacked_pages.currentWidget(), self.assertEqual(process_community.stacked_pages.currentWidget(),
process_community.page_add_nodes, 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) QTest.mouseClick(process_community.button_next, Qt.LeftButton)
asyncio.async(exec_test()) asyncio.async(exec_test())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment