From 2c44bb4a7c995d335f9d79a6074649386bd20b44 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 3 Apr 2018 22:33:57 +0200 Subject: [PATCH] Handle testmode in singleinstance - it still tried to load pyqt in testmode as singleinstance was only checking for daemon and not testmode --- src/singleinstance.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/singleinstance.py b/src/singleinstance.py index ed1048ba..5b9266e2 100644 --- a/src/singleinstance.py +++ b/src/singleinstance.py @@ -26,7 +26,7 @@ class singleinstance: self.lockPid = None self.lockfile = os.path.normpath(os.path.join(state.appdata, 'singleton%s.lock' % flavor_id)) - if not self.daemon and not state.curses: + if not self.daemon and not state.curses and not state.testmode: # Tells the already running (if any) application to get focus. import bitmessageqt bitmessageqt.init() @@ -58,7 +58,7 @@ class singleinstance: else: # non Windows self.fp = open(self.lockfile, 'a+') try: - if self.daemon and self.lockPid != os.getpid(): + if self.daemon and not state.testmode and self.lockPid != os.getpid(): fcntl.lockf(self.fp, fcntl.LOCK_EX) # wait for parent to finish else: fcntl.lockf(self.fp, fcntl.LOCK_EX | fcntl.LOCK_NB) @@ -75,7 +75,7 @@ class singleinstance: def cleanup(self): if not self.initialized: return - if self.daemon and self.lockPid == os.getpid(): + if self.daemon and not state.testmode and self.lockPid == os.getpid(): # these are the two initial forks while daemonizing try: if sys.platform == 'win32':