Ejemplo n.º 1
0
def test_misc_obvious_conflict_checker(monkeypatch):
    # Check that the assert about wrong input data is hit:
    with pytest.raises(AssertionError) as e_info:
        obvious_conflict_checker(
            ctx,
            ["this_is_invalid"]
            # (invalid because it isn't properly nested as tuple)
        )

    # Test that non-recipe dependencies work in overall:
    obvious_conflict_checker(
        ctx, fix_deplist(["python3", "notarecipelibrary"])
    )

    # Test that a conflict with a non-recipe dependency works:
    # This is currently not used, so we need a custom test recipe:
    # To get that, we simply modify one!
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("recipe1", conflicts=[("fakelib")]),
        ])
        with pytest.raises(BuildInterruptingException) as e_info:
            obvious_conflict_checker(ctx, fix_deplist(["recipe1", "fakelib"]))
        assert "conflict" in e_info.value.message.lower()

    # Test a case where a recipe pulls in a conditional tuple
    # of additional dependencies. This is e.g. done for ('python3',
    # 'python2', ...) but most recipes don't depend on this anymore,
    # so we need to add a manual test for this case:
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("recipe1", depends=[("libffi", "Pillow")]),
        ])
        obvious_conflict_checker(ctx, fix_deplist(["recipe1"]))
Ejemplo n.º 2
0
def test_misc_obvious_conflict_checker(monkeypatch):
    # Check that the assert about wrong input data is hit:
    with pytest.raises(AssertionError) as e_info:
        obvious_conflict_checker(
            ctx, ["this_is_invalid"]
            # (invalid because it isn't properly nested as tuple)
        )

    # Test that non-recipe dependencies work in overall:
    obvious_conflict_checker(ctx, fix_deplist(["python3",
                                               "notarecipelibrary"]))

    # Test that a conflict with a non-recipe dependency works:
    # This is currently not used, so we need a custom test recipe:
    # To get that, we simply modify one!
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("recipe1", conflicts=[("fakelib")]),
        ])
        with pytest.raises(BuildInterruptingException) as e_info:
            obvious_conflict_checker(ctx, fix_deplist(["recipe1", "fakelib"]))
        assert "conflict" in e_info.value.message.lower()

    # Test a case where a recipe pulls in a conditional tuple
    # of additional dependencies. This is e.g. done for ('python3',
    # 'python2', ...) but most recipes don't depend on this anymore,
    # so we need to add a manual test for this case:
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("recipe1", depends=[("libffi", "Pillow")]),
        ])
        obvious_conflict_checker(ctx, fix_deplist(["recipe1"]))
Ejemplo n.º 3
0
def test_graph_deplist_transformation():
    test_pairs = [
        (["Pillow", ('python2', 'python3')], [('pillow', ),
                                              ('python2', 'python3')]),
        (["Pillow", ('python2', )], [('pillow', ), ('python2', )]),
    ]
    for (before_list, after_list) in test_pairs:
        assert fix_deplist(before_list) == after_list
Ejemplo n.º 4
0
def test_graph_deplist_transformation():
    test_pairs = [
        (["Pillow", ('python2', 'python3')],
         [('pillow',), ('python2', 'python3')]),
        (["Pillow", ('python2',)],
         [('pillow',), ('python2',)]),
    ]
    for (before_list, after_list) in test_pairs:
        assert fix_deplist(before_list) == after_list
Ejemplo n.º 5
0
def test_multichoice_obvious_conflict_checker(monkeypatch):
    # Test a case where there's a conflict with a multi-choice tuple:
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("recipe1", conflicts=["lib1", "lib2"]),
            get_fake_recipe("recipe2", depends=[("lib1", "lib2")]),
        ])
        with pytest.raises(BuildInterruptingException) as e_info:
            obvious_conflict_checker(
                ctx, fix_deplist([("lib1", "lib2"), "recipe1"]))
        assert "conflict" in e_info.value.message.lower()
Ejemplo n.º 6
0
def test_multichoice_obvious_conflict_checker(monkeypatch):
    # Test a case where there's a conflict with a multi-choice tuple:
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("recipe1", conflicts=["lib1", "lib2"]),
            get_fake_recipe("recipe2", depends=[("lib1", "lib2")]),
        ])
        with pytest.raises(BuildInterruptingException) as e_info:
            obvious_conflict_checker(
                ctx,
                fix_deplist([("lib1", "lib2"), "recipe1"])
            )
        assert "conflict" in e_info.value.message.lower()
Ejemplo n.º 7
0
def test_indirectconflict_obvious_conflict_checker(monkeypatch):
    # Test a case where there's an indirect conflict, which also
    # makes sure the error message correctly blames the OUTER recipes
    # as original conflict source:
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("outerrecipe1", depends=["innerrecipe1"]),
            get_fake_recipe("outerrecipe2", depends=["innerrecipe2"]),
            get_fake_recipe("innerrecipe1"),
            get_fake_recipe("innerrecipe2", conflicts=["innerrecipe1"]),
        ])
        with pytest.raises(BuildInterruptingException) as e_info:
            obvious_conflict_checker(
                ctx, fix_deplist(["outerrecipe1", "outerrecipe2"]))
        assert ("conflict" in e_info.value.message.lower()
                and "outerrecipe1" in e_info.value.message.lower()
                and "outerrecipe2" in e_info.value.message.lower())
Ejemplo n.º 8
0
def test_indirectconflict_obvious_conflict_checker(monkeypatch):
    # Test a case where there's an indirect conflict, which also
    # makes sure the error message correctly blames the OUTER recipes
    # as original conflict source:
    with monkeypatch.context() as m:
        register_fake_recipes_for_test(m, [
            get_fake_recipe("outerrecipe1", depends=["innerrecipe1"]),
            get_fake_recipe("outerrecipe2", depends=["innerrecipe2"]),
            get_fake_recipe("innerrecipe1"),
            get_fake_recipe("innerrecipe2", conflicts=["innerrecipe1"]),
        ])
        with pytest.raises(BuildInterruptingException) as e_info:
            obvious_conflict_checker(
                ctx,
                fix_deplist(["outerrecipe1", "outerrecipe2"])
            )
        assert ("conflict" in e_info.value.message.lower() and
                "outerrecipe1" in e_info.value.message.lower() and
                "outerrecipe2" in e_info.value.message.lower())
Ejemplo n.º 9
0
def test_invalid_obvious_conflict_checker(names, bootstrap):
    # Note: obvious_conflict_checker is stricter on input
    # (needs fix_deplist) than get_recipe_order_and_bootstrap!
    with pytest.raises(BuildInterruptingException) as e_info:
        obvious_conflict_checker(ctx, fix_deplist(names))
    assert "conflict" in e_info.value.message.lower()
Ejemplo n.º 10
0
def test_valid_obvious_conflict_checker(names, bootstrap):
    # Note: obvious_conflict_checker is stricter on input
    # (needs fix_deplist) than get_recipe_order_and_bootstrap!
    obvious_conflict_checker(ctx, fix_deplist(names))
Ejemplo n.º 11
0
def test_invalid_obvious_conflict_checker(names, bootstrap):
    # Note: obvious_conflict_checker is stricter on input
    # (needs fix_deplist) than get_recipe_order_and_bootstrap!
    with pytest.raises(BuildInterruptingException) as e_info:
        obvious_conflict_checker(ctx, fix_deplist(names))
    assert "conflict" in e_info.value.message.lower()
Ejemplo n.º 12
0
def test_valid_obvious_conflict_checker(names, bootstrap):
    # Note: obvious_conflict_checker is stricter on input
    # (needs fix_deplist) than get_recipe_order_and_bootstrap!
    obvious_conflict_checker(ctx, fix_deplist(names))