def test_missing_dependency_reference(self):
     """
     Test resolving an entity whose dependency doesn't exist
     """
     component = Component("component10", "test_flxbindings.fixture.generics.GenericFactory1")
     component._dependencies = [EntityReference("foo-entity")]
     self.manager.add_entity(component)
     self.manager.resolve("component10")
Example #2
0
    def test_non_singleton_dependency(self):
        """
        Ensure non-singleton dependencies are executed every time
        """
        num_inits1 = GenericFactory1.NUM_INITS
        num_inits2 = GenericFactory2.NUM_INITS

        component5_1 = Component("component5_1", "test_flxbindings.fixture.generics.GenericFactory1")
        component5_1._singleton = False
        component5_2 = Component("component5_2", "test_flxbindings.fixture.generics.GenericFactory2")
        component5_2._dependencies = [component5_1]

        self.manager.add_entity(component5_1)
        self.manager.add_entity(component5_2)

        self.manager.resolve("component5_2")
        self.manager.resolve("component5_2")
        self.manager.resolve("component5_2")

        assert GenericFactory1.NUM_INITS == num_inits1 + 1, GenericFactory1.NUM_INITS
        assert GenericFactory2.NUM_INITS == num_inits2 + 1, GenericFactory2.NUM_INITS