Beispiel #1
0
def test_conflicting_deps(capsys, mpkgs, expected_keys, expected_output):
    tree = mock_PackageDAG(mpkgs)
    result = p.conflicting_deps(tree)
    result_keys = {k.key: [v.key for v in vs] for k, vs in result.items()}
    assert expected_keys == result_keys
    p.render_conflicts_text(result)
    captured = capsys.readouterr()
    assert '\n'.join(expected_output).strip() == captured.err.strip()
Beispiel #2
0
def test_conflicting_deps():
    # the custom environment has a bad jinja version and it's missing simplejson
    _, _, conflicting_tree = venv_fixture('tests/virtualenvs/unsatisfiedenv.pickle')
    flask = next((x for x in conflicting_tree.keys() if x.key == 'flask'))
    jinja = next((x for x in conflicting_tree[flask] if x.key == 'jinja2'))
    uritemplate = next((x for x in conflicting_tree.keys() if x.key == 'uritemplate'))
    simplejson = next((x for x in conflicting_tree[uritemplate] if x.key == 'simplejson'))
    assert jinja
    assert flask
    assert uritemplate
    assert simplejson

    unsatisfied = conflicting_deps(conflicting_tree)
    assert unsatisfied == {
        flask: [jinja],
        uritemplate: [simplejson],
    }
def test_conflicting_deps():
    # the custom environment has a bad jinja version and it's missing simplejson
    _, _, conflicting_tree = venv_fixture('tests/virtualenvs/unsatisfiedenv.pickle')
    flask = next((x for x in conflicting_tree.keys() if x.key == 'flask'))
    jinja = next((x for x in conflicting_tree[flask] if x.key == 'jinja2'))
    uritemplate = next((x for x in conflicting_tree.keys() if x.key == 'uritemplate'))
    simplejson = next((x for x in conflicting_tree[uritemplate] if x.key == 'simplejson'))
    assert jinja
    assert flask
    assert uritemplate
    assert simplejson

    unsatisfied = conflicting_deps(conflicting_tree)
    assert unsatisfied == {
        flask: [jinja],
        uritemplate: [simplejson],
    }
Beispiel #4
0
def get_conflicting_dependencies(tree):
    """Returns sorted conflicting dependencies
    :param tree: dictionary of dependencies
    :return: sorted dict of conflicting dependencies
    """
    conflicting_dependencies = dict(pipdeptree.conflicting_deps(tree))

    if conflicting_dependencies:
        conflicting_data = []
        for package in sorted(conflicting_dependencies, key=lambda p: p.key):
            for dependency in sorted(
                    conflicting_dependencies[package], key=lambda d: d.key):
                conflicting_data.append([
                    printer.printable_package(dependency.key),
                    package.key,
                    get_required_package_version(dependency),
                    get_installed_package_version(dependency),
                ])
        return conflicting_data