How to use the pipdeptree.render_json_tree function in pipdeptree

To help you get started, we’ve selected a few pipdeptree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github naiquevin / pipdeptree / tests / test_pipdeptree.py View on Github external
def test_render_json_tree():
    output = render_json_tree(tree, indent=4)
    data = json.loads(output)

    # @TODO: This test fails on travis because gnureadline doesn't
    # appear as a dependency of ipython (which it is)
    #
    # ignored_pkgs = {'pip', 'pipdeptree', 'setuptools', 'wheel'}
    # pkg_keys = set([d['key'].lower() for d in data
    #                 if d['key'].lower() not in ignored_pkgs])
    # expected = {'alembic', 'flask-script', 'ipython',
    #             'lookupy', 'psycopg2', 'redis', 'slugify'}
    # assert pkg_keys - expected == set()

    matching_pkgs = [p for p in data if p['key'] == 'flask-script']
    assert matching_pkgs
    flask_script = matching_pkgs[0]