Used state.testmode to indicate when operating in test mode

This commit is contained in:
Dmitri Bogomolov 2018-04-05 12:50:34 +03:00
parent 54c37150e0
commit 43a471a79b
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 19 additions and 8 deletions

View File

@ -220,13 +220,13 @@ class Main:
daemon = True
elif opt in ("-c", "--curses"):
state.curses = True
elif opt in ("-t", "test"):
daemon = 10
elif opt in ("-t", "--test"):
state.testmode = daemon = True
# is the application already running? If yes then exit.
shared.thisapp = singleinstance("", daemon)
if daemon == 1:
if daemon and not state.testmode:
with shared.printLock:
print('Running as a daemon. Send TERM signal to end.')
self.daemonize()
@ -328,9 +328,18 @@ class Main:
if daemon == False and BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon') == False:
if state.curses == False:
if not depends.check_pyqt():
print('PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon')
print('You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.')
sys.exit()
sys.exit(
'PyBitmessage requires PyQt unless you want'
' to run it as a daemon and interact with it'
' using the API. You can download PyQt from '
'http://www.riverbankcomputing.com/software/pyqt/download'
' or by searching Google for \'PyQt Download\'.'
' If you want to run in daemon mode, see '
'https://bitmessage.org/wiki/Daemon'
'You can also run PyBitmessage with'
' the new curses interface by providing'
' \'-c\' as a commandline argument.'
)
import bitmessageqt
bitmessageqt.run()
@ -344,8 +353,8 @@ class Main:
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
if daemon:
sleep(daemon)
if daemon > 1:
if state.testmode:
sleep(30)
# make testing
self.stop()
while state.shutdown == 0:

View File

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