Skip to content

Instantly share code, notes, and snippets.

@goossaert goossaert/wrapper.py
Created May 24, 2012

Embed
What would you like to do?
Wrapper module which caches data and runs the module to test
import sys
import traceback
import mainprogram
if __name__=='__main__':
cache = None
is_first_iteration = True
while True:
if not cache:
cache = mainprogram.initialize()
try:
if not is_first_iteration:
reload( mainprogram )
is_first_iteration = False
mainprogram.method_to_test( cache )
except Exception, e:
print '*' * 64
print 'Exception raised in tested module'
print traceback.print_exc()
print '*' * 64
print "Press enter to re-run script or CTRL-C to exit"
sys.stdin.readline()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.