mirror of https://github.com/pypa/pip
implement feedback
This commit is contained in:
parent
cf5ce5f16f
commit
88e9ce6e27
|
@ -14,9 +14,9 @@ from pip._vendor.six.moves import xmlrpc_client # type: ignore
|
|||
from pip._internal.cli.base_command import Command
|
||||
from pip._internal.cli.req_command import SessionCommandMixin
|
||||
from pip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS
|
||||
from pip._internal.network.xmlrpc import PipXmlrpcTransport
|
||||
from pip._internal.exceptions import CommandError
|
||||
from pip._internal.models.index import PyPI
|
||||
from pip._internal.network.xmlrpc import PipXmlrpcTransport
|
||||
from pip._internal.utils.compat import get_terminal_size
|
||||
from pip._internal.utils.logging import indent_log
|
||||
from pip._internal.utils.misc import write_output
|
||||
|
|
|
@ -17,8 +17,6 @@ from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
|
|||
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
|
||||
from pip._vendor.requests.structures import CaseInsensitiveDict
|
||||
from pip._vendor.six import PY2
|
||||
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
|
||||
# why we ignore the type on this import
|
||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||
|
||||
import pip
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
"""xmlrpclib.Transport implementation
|
||||
"""
|
||||
import logging
|
||||
|
||||
from pip._vendor import requests
|
||||
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
|
||||
# why we ignore the type on this import
|
||||
from pip._vendor.six.moves import xmlrpc_client # type: ignore
|
||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import pretend
|
|||
import pytest
|
||||
|
||||
from pip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS
|
||||
from pip._internal.commands import create_command
|
||||
from pip._internal.commands.search import (
|
||||
highest_version,
|
||||
print_results,
|
||||
|
@ -105,6 +106,32 @@ def test_search_missing_argument(script):
|
|||
assert 'ERROR: Missing required argument (search query).' in result.stderr
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_run_method_should_return_success_when_find_packages():
|
||||
"""
|
||||
Test SearchCommand.run for found package
|
||||
"""
|
||||
command = create_command('search')
|
||||
cmdline = "--index=https://pypi.org/pypi pip"
|
||||
with command.main_context():
|
||||
options, args = command.parse_args(cmdline.split())
|
||||
status = command.run(options, args)
|
||||
assert status == SUCCESS
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_run_method_should_return_no_matches_found_when_does_not_find_pkgs():
|
||||
"""
|
||||
Test SearchCommand.run for no matches
|
||||
"""
|
||||
command = create_command('search')
|
||||
cmdline = "--index=https://pypi.org/pypi nonexistentpackage"
|
||||
with command.main_context():
|
||||
options, args = command.parse_args(cmdline.split())
|
||||
status = command.run(options, args)
|
||||
assert status == NO_MATCHES_FOUND
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_search_should_exit_status_code_zero_when_find_packages(script):
|
||||
"""
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
import pytest
|
||||
|
||||
from pip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS
|
||||
from pip._internal.commands import create_command
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_run_method_should_return_success_when_find_packages():
|
||||
"""
|
||||
Test SearchCommand.run for found package
|
||||
"""
|
||||
command = create_command('search')
|
||||
cmdline = "--index=https://pypi.org/pypi pip"
|
||||
with command.main_context():
|
||||
options, args = command.parse_args(cmdline.split())
|
||||
status = command.run(options, args)
|
||||
assert status == SUCCESS
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_run_method_should_return_no_matches_found_when_does_not_find_pkgs():
|
||||
"""
|
||||
Test SearchCommand.run for no matches
|
||||
"""
|
||||
command = create_command('search')
|
||||
cmdline = "--index=https://pypi.org/pypi nonexistentpackage"
|
||||
with command.main_context():
|
||||
options, args = command.parse_args(cmdline.split())
|
||||
status = command.run(options, args)
|
||||
assert status == NO_MATCHES_FOUND
|
Loading…
Reference in New Issue