def _add_reverse_resolvers(self, directory):
     classes = get_subclasses(directory=directory,
                              class_type=ReverseResolver)
     self.logger.debug("_add_reverse_resolvers for directory %s are %s",
                       directory, str(classes))
     for node_class in classes.values():
         self._reverse_resolver_list.append(node_class(self))
Beispiel #2
0
    def test_get_subclasses(self):
        directory = os.path.join(os.getcwd(), "sceptre", "resolvers")
        classes = get_subclasses(Resolver, directory)

        # This is actually checking a property of the classes, which isn't
        # ideal but it's difficult to assert that the classes themselves are
        # the same.
        assert classes["environment_variable"].__name__ == \
            "EnvironmentVariable"
        assert classes["file_contents"].__name__ == \
            "FileContents"
        assert classes["stack_output_external"].__name__ == \
            "StackOutputExternal"
        assert classes["stack_output"].__name__ ==  \
            "StackOutput"
        assert len(classes) == 4
Beispiel #3
0
    def test_get_subclasses(self):
        directory = os.path.join(os.getcwd(), "sceptre", "resolvers")
        classes = get_subclasses(Resolver, directory)

        # This is actually checking a property of the classes, which isn't
        # ideal but it's difficult to assert that the classes themselves are
        # the same.
        assert classes["environment_variable"].__name__ == \
            "EnvironmentVariable"
        assert classes["file_contents"].__name__ == \
            "FileContents"
        assert classes["stack_output_external"].__name__ == \
            "StackOutputExternal"
        assert classes["stack_output"].__name__ ==  \
            "StackOutput"
        assert classes["project_variables"].__name__ == \
            "ProjectVariables"
        assert len(classes) == 5
Beispiel #4
0
 def test_get_subclasses_with_invalid_directory(self):
     with pytest.raises(TypeError):
         get_subclasses(Hook, 1)