Ejemplo n.º 1
0
def test_run_method_should_return_no_matches_found_when_does_not_find_pkgs():
    """
    Test SearchCommand.run for no matches
    """
    command = SearchCommand()
    cmdline = "--index=https://pypi.org/pypi nonexistentpackage"
    options, args = command.parse_args(cmdline.split())
    status = command.run(options, args)
    assert status == NO_MATCHES_FOUND
Ejemplo n.º 2
0
def test_run_method_should_return_success_when_find_packages():
    """
    Test SearchCommand.run for found package
    """
    command = SearchCommand()
    cmdline = "--index=https://pypi.org/pypi pip"
    options, args = command.parse_args(cmdline.split())
    status = command.run(options, args)
    assert status == SUCCESS
Ejemplo n.º 3
0
def test_run_method_should_return_success_when_find_packages():
    """
    Test SearchCommand.run for found package
    """
    command = SearchCommand()
    cmdline = "--index=https://pypi.org/pypi pip"
    options, args = command.parse_args(cmdline.split())
    status = command.run(options, args)
    assert status == SUCCESS
Ejemplo n.º 4
0
def test_run_method_should_return_no_matches_found_when_does_not_find_pkgs():
    """
    Test SearchCommand.run for no matches
    """
    command = SearchCommand()
    cmdline = "--index=https://pypi.org/pypi nonexistentpackage"
    options, args = command.parse_args(cmdline.split())
    status = command.run(options, args)
    assert status == NO_MATCHES_FOUND
Ejemplo n.º 5
0
def SearchCommand(spec, operator, *args, **kw):
    """Guild specific pip search implementation.

    This exposes the search fields and operator, which were are hard
    coded in the pip implementation.

    Implemented as a function to defer import of upstream
    implementation.
    """
    from pip._internal.commands.search import SearchCommand
    cmd = SearchCommand(*args, **kw)
    cmd._spec = spec
    cmd._operator = operator
    util.bind_method(cmd, "search", _SearchCommand_search)
    return cmd