Exemple #1
0
def test_version(tmp_path, capsys):
    set_env(tmp_path)

    sys.argv = ["pipis", "version"]
    main()
    captured = capsys.readouterr()

    assert re.match(r"^pipis version: \d+\.\d+\.\d+", captured.out)
Exemple #2
0
def test_install(tmp_path, capsys):
    set_env(tmp_path)

    package = "pipis"
    sys.argv = ["pipis", "install", "-y", package]
    main()
    captured = capsys.readouterr()

    assert f"Successfully installed {package}" in captured.out
Exemple #3
0
def test_install_dependency(tmp_path, capsys):
    set_env(tmp_path)

    package = "pipis"
    dependency = "flake8"
    sys.argv = ["pipis", "install", "-y", package, "-d", dependency]
    main()
    captured = capsys.readouterr()

    assert f"Successfully installed {package}" in captured.out
Exemple #4
0
def test_freeze(tmp_path, capsys):
    set_env(tmp_path)
    # install a package before test
    package = "pipis"
    sys.argv = ["pipis", "install", "-y", package]
    main()

    sys.argv = ["pipis", "freeze"]
    main()
    captured = capsys.readouterr()

    assert f"{package}==" in captured.out
Exemple #5
0
def test_install_version(tmp_path, capsys):
    set_env(tmp_path)

    package = "pipis==1.0.0"
    sys.argv = ["pipis", "install", "-y", package]
    main()
    sys.argv = ["pipis", "freeze"]
    main()
    captured = capsys.readouterr()

    assert f"Successfully installed {package}" in captured.out
    assert package in captured.out
Exemple #6
0
def test_uninstall(tmp_path, capsys):
    set_env(tmp_path)
    p = Pipis()
    args = Args()
    p.install(args)
    capsys.readouterr()  # reset capture

    sys.argv = ["pipis", "uninstall", "-y", args.package]
    main()
    captured = capsys.readouterr()

    assert captured.out == f"Successfully uninstalled {args.package}\n"
Exemple #7
0
def test_search(tmp_path, capsys):
    set_env(tmp_path)
    p = Pipis()
    args = Args()
    p.install(args)

    package = "pipis"
    sys.argv = ["pipis", "search", package]
    main()
    captured = capsys.readouterr()

    assert "not found" not in captured.out
    assert package in captured.out
Exemple #8
0
def test_search_inexistant(tmp_path, capsys):
    set_env(tmp_path)
    p = Pipis()
    args = Args()
    p.install(args)
    capsys.readouterr()  # reset capture

    package = "pipistache"
    sys.argv = ["pipis", "search", package]
    main()
    captured = capsys.readouterr()

    assert captured.out == f"Package '{package}' not found\n"