update stability test

This commit is contained in:
Luke Campagnola 2014-04-15 15:10:04 -04:00
parent ef7949a35e
commit d45eadc9a5

View File

@ -45,21 +45,26 @@ def test_stability():
#setParent, #setParent,
forgetWidget, forgetWidget,
showWidget, showWidget,
#processEvents, processEvents,
#raiseException, #raiseException,
#addReference, #addReference,
] ]
thread = WorkThread() thread = WorkThread()
#thread.start() thread.start()
while True: while True:
try: try:
action = randItem(actions) action = randItem(actions)
action() action()
print('[%d widgets alive]' % len(allWidgets)) print('[%d widgets alive, %d zombie]' % (len(allWidgets), len(allWidgets) - len(widgets)))
except KeyboardInterrupt: except KeyboardInterrupt:
thread.kill() print("Caught interrupt; send another to exit.")
try:
for i in range(100):
QTest.qWait(100)
except KeyboardInterrupt:
thread.terminate()
break break
except: except:
sys.excepthook(*sys.exc_info()) sys.excepthook(*sys.exc_info())
@ -88,7 +93,10 @@ def p(msg):
def createWidget(): def createWidget():
p('create widget') p('create widget')
global widgets, allWidgets global widgets, allWidgets
if len(widgets) > 50:
return
widget = randItem(widgetTypes)() widget = randItem(widgetTypes)()
widget.setWindowTitle(widget.__class__.__name__)
widgets.append(widget) widgets.append(widget)
allWidgets.add(widget) allWidgets.add(widget)
p(" %s" % widget) p(" %s" % widget)