Created
May 24, 2012 17:57
-
-
Save goossaert/2783132 to your computer and use it in GitHub Desktop.
Wrapper module which caches data and runs the module to test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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