Example #1
0
 def setup_method(self, method):
     ModuleFactory.unregister()
     ModuleFactory.register('MockModuleContext', MockModuleContext)
     ModuleFactory.register('MockModuleData', MockModuleData)
     self.builder = SequentialPipeline()
     self.mod_c = MockModuleContext('mod_c')
     self.mod_d1 = MockModuleData('mod_d1')
     self.mod_d2 = MockModuleData('mod_d2')
    def setup_method(self, method):
        @produce(MockCorrectDependingInterface)
        @finalize
        class ModuleDependingCorrect(Module.Runtime):
            def run(self, *args, **kwargs):
                pass

        @produce(MockIncorrectDependingInterface)
        @finalize
        class ModuleDependingIncorrect(Module.Runtime):
            def run(self, *args, **kwargs):
                pass

        ModuleFactory.unregister()
        ModuleFactory.register('ModuleDependingCorrect',
                               ModuleDependingCorrect)
        ModuleFactory.register('ModuleDependingIncorrect',
                               ModuleDependingIncorrect)
Example #3
0
 def teardown_method(self, method):
     del self.mod_c
     del self.mod_d1
     del self.mod_d2
     ModuleFactory.unregister()
Example #4
0
 def teardown_method(self, method):
     ModuleFactory.unregister()
Example #5
0
 def setup_method(self, method):
     ModuleFactory.unregister()
     ModuleFactory.register('MockModule', MockModule)
     self.pipeline = SequentialPipeline()
     self.context = MockContext()
 def test_cannot_register_interfaces(self):
     with pytest.raises(TypeError):
         ModuleFactory.unregister()
         ModuleFactory.register('MockCorrectDependingInterface',
                                MockCorrectDependingInterface)
Example #7
0
 def test_remove_nonregistered_module(self):
     with pytest.warns(UserWarning):
         ModuleFactory.unregister('NotRegisteredModuleName')
Example #8
0
 def test_remove_registered_module(self):
     assert len(ModuleFactory.module_references) == 0
     ModuleFactory.register('MockModule', MockModule)
     assert len(ModuleFactory.module_references) == 1
     ModuleFactory.unregister('MockModule')
     assert len(ModuleFactory.module_references) == 0
Example #9
0
 def setup_method(self, method):
     ModuleFactory.unregister()
 def setup_method(self, method):
     ModuleFactory.unregister()
     ModuleFactory.register('MockModuleA', MockModuleA)
     ModuleFactory.register('MockModuleB', MockModuleB)