Exemplo n.º 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)
Exemplo n.º 3
0
 def teardown_method(self, method):
     del self.mod_c
     del self.mod_d1
     del self.mod_d2
     ModuleFactory.unregister()
Exemplo n.º 4
0
 def teardown_method(self, method):
     ModuleFactory.unregister()
Exemplo n.º 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)
Exemplo n.º 7
0
 def test_remove_nonregistered_module(self):
     with pytest.warns(UserWarning):
         ModuleFactory.unregister('NotRegisteredModuleName')
Exemplo n.º 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
Exemplo n.º 9
0
 def setup_method(self, method):
     ModuleFactory.unregister()
Exemplo n.º 10
0
 def setup_method(self, method):
     ModuleFactory.unregister()
     ModuleFactory.register('MockModuleA', MockModuleA)
     ModuleFactory.register('MockModuleB', MockModuleB)