예제 #1
0
 def inner(*args, **kwargs):
     model = Model(func.func_name, _export=False)
     # manually set up SelfExporter, targeting func's globals
     SelfExporter.default_model = model
     SelfExporter.target_module = func.__module__
     SelfExporter.target_globals = func.func_globals
     SelfExporter.target_globals['model'] = model
     # call the actual test function
     func(*args, **kwargs)
     # clean up the globals
     SelfExporter.cleanup()
예제 #2
0
파일: __init__.py 프로젝트: BAngermann/pysb
 def inner(*args, **kwargs):
     model = Model(func.func_name, _export=False)
     # manually set up SelfExporter, targeting func's globals
     SelfExporter.default_model = model
     SelfExporter.target_module = func.__module__
     SelfExporter.target_globals = func.func_globals
     SelfExporter.target_globals['model'] = model
     # call the actual test function
     func(*args, **kwargs)
     # clean up the globals
     SelfExporter.cleanup()
예제 #3
0
 def inner(*args, **kwargs):
     model = Model(func.__name__, _export=False)
     # manually set up SelfExporter, targeting func's globals
     selfexporter_state = SelfExporter.do_export
     SelfExporter.do_export = True
     SelfExporter.default_model = model
     SelfExporter.target_module = func.__module__
     SelfExporter.target_globals = func.__globals__
     SelfExporter.target_globals['model'] = model
     try:
         # call the actual test function
         func(*args, **kwargs)
     finally:
         # clean up the globals
         SelfExporter.cleanup()
         SelfExporter.do_export = selfexporter_state
예제 #4
0
 def inner(*args, **kwargs):
     model = Model(func.__name__, _export=False)
     # manually set up SelfExporter, targeting func's globals
     selfexporter_state = SelfExporter.do_export
     SelfExporter.do_export = True
     SelfExporter.default_model = model
     SelfExporter.target_module = func.__module__
     SelfExporter.target_globals = func.__globals__
     SelfExporter.target_globals['model'] = model
     try:
         # call the actual test function
         func(*args, **kwargs)
     finally:
         # clean up the globals
         SelfExporter.cleanup()
         SelfExporter.do_export = selfexporter_state