@contextmanager
@deprecated(u'1.4.0', _deprecation_msg)
def subsystem_instance(subsystem_type, scope=None, **options):
 if (not issubclass(subsystem_type, Subsystem)):
  raise TypeError(u'The given `subsystem_type` was not a subclass of `Subsystem`: {}'.format(subsystem_type))
 optionables = Subsystem.closure([subsystem_type])
 updated_options = (dict(Subsystem._options.items()) if Subsystem._options else {})
 if options:
  updated_options.update(options)
 Subsystem._options = create_options_for_optionables(optionables, options=updated_options)
 try:
  if (scope is None):
   (yield subsystem_type.global_instance())
  else:
   class ScopedOptionable(Optionable, ):
    options_scope = scope
    options_scope_category = ScopeInfo.SUBSYSTEM
   (yield subsystem_type.scoped_instance(ScopedOptionable))
 finally:
  Subsystem.reset()

@ contextmanager @ deprecated ( u'1.4.0' , _deprecation_msg ) def subsystem_instance ( subsystem_type , scope = None , ** options ) : if ( not issubclass ( subsystem_type , Subsystem ) ) : raise TypeError ( u'The given `subsystem_type` was not a subclass of `Subsystem`: {}' . format ( subsystem_type ) ) optionables = Subsystem . closure ( [ subsystem_type ] ) updated_options = ( dict ( Subsystem . _options . items ( ) ) if Subsystem . _options else { } ) if options : updated_options . update ( options ) Subsystem . _options = create_options_for_optionables ( optionables , options = updated_options ) try : if ( scope is None ) : ( yield subsystem_type . global_instance ( ) ) else : class ScopedOptionable ( Optionable , ) : options_scope = scope options_scope_category = ScopeInfo . SUBSYSTEM ( yield subsystem_type . scoped_instance ( ScopedOptionable ) ) finally : Subsystem . reset ( )
creates a subsystem instance for test .