Move test mode into state

- test mode variable is now in state
This commit is contained in:
Peter Šurda 2018-04-02 08:54:44 +02:00
parent 1a76c1df97
commit bf8c2f44f6
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 8 additions and 7 deletions

View File

@ -221,12 +221,12 @@ class Main:
elif opt in ("-c", "--curses"):
state.curses = True
elif opt in ("-t", "test"):
daemon = 10
state.testmode = True
# is the application already running? If yes then exit.
shared.thisapp = singleinstance("", daemon)
if daemon == 1:
if daemon:
with shared.printLock:
print('Running as a daemon. Send TERM signal to end.')
self.daemonize()
@ -343,11 +343,10 @@ class Main:
else:
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
if daemon:
sleep(daemon)
if daemon > 1:
# make testing
self.stop()
if state.testmode:
sleep(10)
self.stop()
if daemon or state.testmode:
while state.shutdown == 0:
sleep(1)

View File

@ -55,3 +55,5 @@ def resetNetworkProtocolAvailability():
resetNetworkProtocolAvailability()
dandelion = 0
testmode = False