2019-01-09 22:59:03 +00:00
|
|
|
#!/usr/bin/env python3
|
2020-03-25 21:15:57 +00:00
|
|
|
from hydrus import QtPorting as QP
|
2019-11-14 03:56:30 +00:00
|
|
|
from qtpy import QtWidgets as QW
|
|
|
|
from qtpy import QtCore as QC
|
2015-11-25 22:00:57 +00:00
|
|
|
|
2014-07-30 21:18:17 +00:00
|
|
|
import locale
|
|
|
|
|
|
|
|
try: locale.setlocale( locale.LC_ALL, '' )
|
|
|
|
except: pass
|
|
|
|
|
2020-03-25 21:15:57 +00:00
|
|
|
from hydrus import HydrusConstants as HC
|
|
|
|
from hydrus import HydrusData
|
|
|
|
from hydrus import HydrusGlobals as HG
|
|
|
|
from hydrus import TestController
|
2013-11-06 18:22:07 +00:00
|
|
|
import sys
|
2013-11-27 18:27:11 +00:00
|
|
|
import threading
|
2019-02-13 22:26:43 +00:00
|
|
|
import traceback
|
2013-11-27 18:27:11 +00:00
|
|
|
from twisted.internet import reactor
|
2013-11-06 18:22:07 +00:00
|
|
|
|
2013-07-24 20:26:00 +00:00
|
|
|
if __name__ == '__main__':
|
2013-07-10 20:25:57 +00:00
|
|
|
|
2013-11-06 18:22:07 +00:00
|
|
|
args = sys.argv[1:]
|
|
|
|
|
|
|
|
if len( args ) > 0:
|
|
|
|
|
|
|
|
only_run = args[0]
|
|
|
|
|
2019-03-13 21:04:21 +00:00
|
|
|
else:
|
|
|
|
|
|
|
|
only_run = None
|
|
|
|
|
2013-11-06 18:22:07 +00:00
|
|
|
|
2015-08-26 21:18:39 +00:00
|
|
|
try:
|
|
|
|
|
|
|
|
threading.Thread( target = reactor.run, kwargs = { 'installSignalHandlers' : 0 } ).start()
|
|
|
|
|
2019-11-14 03:56:30 +00:00
|
|
|
QP.MonkeyPatchMissingMethods()
|
|
|
|
app = QW.QApplication( sys.argv )
|
|
|
|
|
2020-02-19 21:48:36 +00:00
|
|
|
app.call_after_catcher = QP.CallAfterEventCatcher( app )
|
2015-09-02 23:16:09 +00:00
|
|
|
|
2016-06-08 20:27:22 +00:00
|
|
|
try:
|
|
|
|
|
2019-11-14 03:56:30 +00:00
|
|
|
# we run the tests on the Qt thread atm
|
2018-01-03 22:37:30 +00:00
|
|
|
# keep a window alive the whole time so the app doesn't finish its mainloop
|
|
|
|
|
2019-11-14 03:56:30 +00:00
|
|
|
win = QW.QWidget( None )
|
|
|
|
win.setWindowTitle( 'Running tests...' )
|
2016-06-08 20:27:22 +00:00
|
|
|
|
2019-03-13 21:04:21 +00:00
|
|
|
controller = TestController.Controller( win, only_run )
|
|
|
|
|
2017-03-22 22:38:15 +00:00
|
|
|
def do_it():
|
|
|
|
|
2019-02-13 22:26:43 +00:00
|
|
|
controller.Run( win )
|
2017-03-22 22:38:15 +00:00
|
|
|
|
2016-06-08 20:27:22 +00:00
|
|
|
|
2019-11-14 03:56:30 +00:00
|
|
|
QP.CallAfter( do_it )
|
2018-01-03 22:37:30 +00:00
|
|
|
|
2019-11-14 03:56:30 +00:00
|
|
|
app.exec_()
|
2016-06-08 20:27:22 +00:00
|
|
|
|
|
|
|
except:
|
|
|
|
|
2016-10-19 20:02:56 +00:00
|
|
|
HydrusData.DebugPrint( traceback.format_exc() )
|
2016-06-08 20:27:22 +00:00
|
|
|
|
|
|
|
finally:
|
|
|
|
|
2017-05-10 21:33:58 +00:00
|
|
|
HG.view_shutdown = True
|
2016-06-08 20:27:22 +00:00
|
|
|
|
|
|
|
controller.pubimmediate( 'wake_daemons' )
|
|
|
|
|
2017-05-10 21:33:58 +00:00
|
|
|
HG.model_shutdown = True
|
2016-06-08 20:27:22 +00:00
|
|
|
|
|
|
|
controller.pubimmediate( 'wake_daemons' )
|
|
|
|
|
2016-10-12 21:52:50 +00:00
|
|
|
controller.TidyUp()
|
2016-06-08 20:27:22 +00:00
|
|
|
|
2015-08-26 21:18:39 +00:00
|
|
|
|
2015-09-16 18:11:00 +00:00
|
|
|
except:
|
|
|
|
|
2016-10-19 20:02:56 +00:00
|
|
|
HydrusData.DebugPrint( traceback.format_exc() )
|
2015-09-16 18:11:00 +00:00
|
|
|
|
2015-08-26 21:18:39 +00:00
|
|
|
finally:
|
|
|
|
|
|
|
|
reactor.callFromThread( reactor.stop )
|
|
|
|
|
2016-06-08 20:27:22 +00:00
|
|
|
print( 'This was version ' + str( HC.SOFTWARE_VERSION ) )
|
2015-08-26 21:18:39 +00:00
|
|
|
|
2019-01-09 22:59:03 +00:00
|
|
|
input()
|
2016-12-21 22:30:54 +00:00
|
|
|
|