Skip to content

Instantly share code, notes, and snippets.

@goossaert
Created May 24, 2012 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goossaert/2783132 to your computer and use it in GitHub Desktop.
Save goossaert/2783132 to your computer and use it in GitHub Desktop.
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