From f8f7b8a9bc2cd8becff2ed2cf21bb4b711217d98 Mon Sep 17 00:00:00 2001 From: Thyagarajan Balakrishnan Date: Mon, 30 Jan 2012 16:22:18 +0200 Subject: [PATCH] fixed unhandled exception due while removing log file from tmp dir RevBy: Marek Ruszczak --- .../harmattan/testscripts/test-single-instance.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/harmattan/testscripts/test-single-instance.py b/tests/harmattan/testscripts/test-single-instance.py index 1c3920f..0029dff 100644 --- a/tests/harmattan/testscripts/test-single-instance.py +++ b/tests/harmattan/testscripts/test-single-instance.py @@ -299,15 +299,17 @@ class SingleInstanceTests(CustomTestCase): # 4. Check that there in only one application pid and it has the same than with 1. launch # 5. Check that window is raised with correct pid (from log files written by test application) + def removefile(filename): + try: + os.remove(filename) + except: + pass + app = '/usr/bin/fala_multi-instance' logFileName = '/tmp/fala_multi-instance.log' kill_process(app) - - try: - os.remove(logFileName) - except: - pass + removefile(logFileName) run_cmd_as_user("%s %s foo" % (si_cmd, app)) pid1 = wait_for_app(app) @@ -341,7 +343,7 @@ class SingleInstanceTests(CustomTestCase): break finally: kill_process(app, signum = 15) - os.remove(logFileName) + removefile(logFileName) def single_instance_abnormal_lock_release(self, si_cmd): # 1. Start the multi-instance application with single-instance binary