Package schrodinger :: Package test :: Package squish :: Package canvas :: Module exception_handling
[hide private]
[frames] | no frames]

Module exception_handling

Exception handling. Functions to start and stop Canvas. Requires use of squish_modules/general/general.py

To use, place the following code at the top of your test.py: source( findFile( "scripts", "canvas/exception_handling.py"))

Copyright (c) Schrodinger, LLC. All rights reserved

Functions [hide private]
 
start_canvas(cmd=cmd_input, timeout=long_wait)
Waits for Canvas to open.
 
quit_canvas()
Quits Canvas closing error/overwrite windows.
 
catchTerminalErrors(obj)
Polls stderr for unexpected terminal output during test execution.
 
handleCloseProjectDialogs(dialog)
Handle close project dialogs which depend on whether project is saved or scratch
Variables [hide private]
  _OBJECT_INTERACT_DEQUE = _dq([], 20)
  _CANVAS_STDERR_STORED = ''
  _new_objects = {":&File_QAction": "{container=':Canvas*_QMenuB...
  _dllpreload = os.environ.get("SQUISH_PREFIX")+ r'\bin\dllprelo...
  _canv_exec = _hunt('canvas', 'exec')+ '/canvas.exe'
  cmd_input = 'canvas'
Function Details [hide private]

start_canvas(cmd=cmd_input, timeout=long_wait)

 

Waits for Canvas to open. Application context stored as global _canvas.

Parameters:
  • cmd - The command to execute.
  • timeout - The length of time to wait (msec, default long_wait)

quit_canvas()

 

Quits Canvas closing error/overwrite windows. Logs stdout and all filtered stderr (stderr not reported by catchTerminalErrors eventHandler.

catchTerminalErrors(obj)

 

Polls stderr for unexpected terminal output during test execution. Implemented by event handler keyed from QMouseEvent so that the obj passed to this function should be whatever object was clicked most recently. Sometimes the most recent object clicked will have no symbolic or real name so a deque of the most recent objects is logged to aid in debugging.


Variables Details [hide private]

_new_objects

Value:
{":&File_QAction": "{container=':Canvas*_QMenuBar' text='&File' type='\
QAction' unnamed='1' visible='true'}", ":Canvas*_QMenuBar": "{type='QM\
enuBar' unnamed='1' visible='1' window=':Canvas_ChmMainWindow'}", ":Ca\
nvas_ChmMainWindow": "{name='ChmMainWindow' type='ChmMainWindow' visib\
le='1' windowTitle?='Canvas*'}", ":Canvas_QMessageBox": "{type='QMessa\
geBox' unnamed='1' visible='1' windowTitle='Canvas'}", ":Canvas.OK_QPu\
shButton": "{text='OK' type='QPushButton' unnamed='1' visible='1' wind\
ow=':Canvas_QMessageBox'}",}

_dllpreload

Value:
os.environ.get("SQUISH_PREFIX")+ r'\bin\dllpreload.exe'