Ejemplo n.º 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()
Ejemplo n.º 2
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()
Ejemplo n.º 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
Ejemplo n.º 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