How to use the johnnydep.cli.main function in johnnydep

To help you get started, we’ve selected a few johnnydep 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 wimglenn / johnnydep / tests / test_cli.py View on Github external
def test_printed_tree_on_stdout(mocker, capsys, make_dist):
    make_dist(name="thing", extras_require={"xyz": "spam>0.30.0", "abc": "eggs"})
    make_dist(name="spam", version="0.31")
    make_dist(name="eggs")
    mocker.patch(
        "sys.argv", "johnnydep thing[xyz] --fields extras_available extras_requested".split()
    )
    main()
    out, err = capsys.readouterr()
    assert err == ""
    assert out == dedent(
        """\
        name             extras_available    extras_requested
github wimglenn / johnnydep / tests / test_cli.py View on Github external
make_dist(name="distA", install_requires=["distB1", "distB2"], version="0.1")
    make_dist(name="distB1", install_requires=["distC[x,z]<0.3"], version="0.1")
    make_dist(name="distB2", install_requires=["distC[y]!=0.2"], version="0.1")
    make_dist(name="distC", version="0.1")
    make_dist(name="distC", version="0.2")
    make_dist(name="distC", version="0.3")
    fields = [
        "name",
        "specifier",
        "requires",
        "required_by",
        "versions_available",
        "version_latest_in_spec",
    ]
    mocker.patch("sys.argv", "johnnydep distA --fields".split() + fields)
    main()
    out, err = capsys.readouterr()
    assert err == ""
    assert out == dedent(
        """\
    name                specifier    requires        required_by    versions_available      version_latest_in_spec
github wimglenn / johnnydep / tests / test_cli.py View on Github external
def test_all_fields_toml_out(mocker, capsys, make_dist):
    _dist, _dist_path, checksum = make_dist(name="wimpy", version="0.3", py_modules=["that"])
    mocker.patch("sys.argv", "johnnydep wimpy<0.4 --fields=ALL --output-format=toml".split())
    main()
    out, err = capsys.readouterr()
    assert err == ""
    assert out == dedent(
        """\
        name = "wimpy"
        summary = "default text for metadata summary"
        specifier = "<0.4"
        requires = []
        required_by = []
        import_names = [ "that",]
        homepage = "https://www.example.org/default"
        extras_available = []
        extras_requested = []
        project_name = "wimpy"
        versions_available = [ "0.3",]
        version_installed = "0.3"
github wimglenn / johnnydep / tests / test_cli.py View on Github external
def test_requirements_txt_output(mocker, capsys, make_dist):
    make_dist(name="distA", install_requires=["distB1", "distB2"], version="0.1")
    make_dist(name="distB1", install_requires=["distC[x,z]<0.3"], version="0.1")
    make_dist(name="distB2", install_requires=["distC[y]!=0.2"], version="0.1")
    make_dist(name="distC", version="0.1")
    make_dist(name="distC", version="0.2")
    make_dist(name="distC", version="0.3")
    mocker.patch("sys.argv", "johnnydep distA -o pinned".split())
    main()
    out, err = capsys.readouterr()
    assert err == ""
    assert out == dedent(
        """\
        distA==0.1
github wimglenn / johnnydep / tests / test_cli.py View on Github external
def test_printed_table_on_stdout_with_specifier(make_dist, mocker, capsys):
    make_dist()
    mocker.patch("sys.argv", "johnnydep jdtest>=0.1 --fields specifier".split())
    main()
    out, err = capsys.readouterr()
    assert err == ""
    assert out == dedent(
        """\
        name    specifier
github wimglenn / johnnydep / tests / test_cli.py View on Github external
def test_unresolvable_deptree(mocker, capsys, make_dist):
    # It is still possible to print the dep tree even though there is no acceptable version available for distC
    make_dist(name="distX", install_requires=["distC<=0.1", "distC>0.2"], version="0.1")
    make_dist(name="distC", version="0.1")
    make_dist(name="distC", version="0.2")
    make_dist(name="distC", version="0.3")
    fields = "name requires required_by versions_available version_latest_in_spec".split()
    mocker.patch("sys.argv", "johnnydep distX --fields".split() + fields)
    main()
    out, err = capsys.readouterr()
    assert err == ""
    assert out == dedent(
        """\
        name            requires               required_by    versions_available      version_latest_in_spec
github wimglenn / johnnydep / tests / test_cli.py View on Github external
def test_printed_table_on_stdout(mocker, capsys, make_dist):
    make_dist()
    mocker.patch("sys.argv", "johnnydep jdtest==0.1.2".split())
    main()
    out, err = capsys.readouterr()
    assert err == ""
    assert out == dedent(
        """\
        name           summary