Exemple #1
0
def test_graph_should_import_feature_with_feature_dependencies():
    mdl = MockDependencyLoader()
    mdl.a_feature("test", features=["test2"])
    mdl.a_feature("test2", imports=["from setuptools import setup"])

    g = Setup(mdl)
    g.add_feature("test")

    assert g.imports == {"from setuptools import setup"}
    assert g.features == {Feature("test"), Feature("test2")}
Exemple #2
0
def test_adding_cyclical_feature_dependencies_is_fine():
    mdl = MockDependencyLoader()
    mdl.a_feature("test", features=["test2"])
    mdl.a_feature("test2", features=["test3"])
    mdl.a_feature("test3", features=["test"])

    g = Setup(mdl)
    g.add_feature("test")

    assert g.features == {Feature("test"), Feature("test2"), Feature("test3")}
Exemple #3
0
def test_graph_should_produce_the_minimal_import_dependency_set():
    mdl = MockDependencyLoader()
    mdl.a_feature("test", ["from setuptools import setup"])
    mdl.a_feature("test2", ["from setuptools import setup"])

    g = Setup(mdl)
    g.add_feature("test")
    g.add_feature("test2")

    assert g.imports == {"from setuptools import setup"}
    assert g.features == {Feature("test"), Feature("test2")}
Exemple #4
0
def test_graph_should_produce_minimal_feature_dependency_set_by_name():
    mdl = MockDependencyLoader()
    mdl.a_setting("test", features=["test3"])
    mdl.a_feature("test2", features=["test3"])
    mdl.a_feature("test3", imports=["from setuptools import setup"])

    g = Setup(mdl)
    g.add_setting("test")
    g.add_feature("test2")

    assert g.imports == {"from setuptools import setup"}
    assert g.features == {Feature("test2"), Feature("test3")}
    assert g.settings == [Setting("test")]
Exemple #5
0
    def a_feature(self, feature_name, imports=[], features=[], code=""):
        test_feature = Feature(feature_name, {
            "imports": imports,
            "features": features
        }, code)

        self._features[feature_name] = test_feature
Exemple #6
0
def test_graph_should_be_able_to_load_feature_with_import_dependencies():
    mdl = MockDependencyLoader()
    mdl.a_feature("test", ["from setuptools import setup"])

    g = Setup(mdl)
    g.add_feature("test")

    assert g.imports == {"from setuptools import setup"}
    assert g.features == {Feature("test")}
Exemple #7
0
    def load_feature(self, contents, code):
        properties = yaml.load(contents, Loader=yaml.Loader)

        return Feature(properties["name"], properties.get("dependencies", {}),
                       code)