summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzu-ping Chung <uranusjr@gmail.com>2020-12-15 17:18:12 +0800
committerTzu-ping Chung <uranusjr@gmail.com>2020-12-15 17:23:20 +0800
commit145be2eaf2c2a3433c761a5c8a41e2de453e81b1 (patch)
tree3c34c86f4d336cfaf0f42b0dcfd6fef748d2ca44
parent2b0b426b77275a7c1321606ddc9b717ea592d924 (diff)
downloadpip-145be2eaf2c2a3433c761a5c8a41e2de453e81b1.tar.gz
Skip pip search tests unless explicitly requested
-rw-r--r--setup.cfg1
-rw-r--r--tests/conftest.py10
-rw-r--r--tests/functional/test_search.py9
3 files changed, 20 insertions, 0 deletions
diff --git a/setup.cfg b/setup.cfg
index 8d9edbcc0..84a959a32 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -61,6 +61,7 @@ markers =
mercurial: VCS: Mercurial
git: VCS: git
yaml: yaml based tests
+ search: tests for 'pip search'
[coverage:run]
branch = True
diff --git a/tests/conftest.py b/tests/conftest.py
index 6f7bd1a6c..dc1fdb514 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -51,6 +51,12 @@ def pytest_addoption(parser):
default=False,
help="use venv for virtual environment creation",
)
+ parser.addoption(
+ "--run-search",
+ action="store_true",
+ default=False,
+ help="run 'pip search' tests",
+ )
def pytest_collection_modifyitems(config, items):
@@ -58,6 +64,10 @@ def pytest_collection_modifyitems(config, items):
if not hasattr(item, 'module'): # e.g.: DoctestTextfile
continue
+ if (item.get_closest_marker('search') and
+ not config.getoption('--run-search')):
+ item.add_marker(pytest.mark.skip('pip search test skipped'))
+
if "CI" in os.environ:
# Mark network tests as flaky
if item.get_closest_marker('network') is not None:
diff --git a/tests/functional/test_search.py b/tests/functional/test_search.py
index 875e2e5d6..b8bc6d51e 100644
--- a/tests/functional/test_search.py
+++ b/tests/functional/test_search.py
@@ -56,6 +56,7 @@ def test_pypi_xml_transformation():
@pytest.mark.network
+@pytest.mark.search
def test_basic_search(script):
"""
End to end test of search command.
@@ -75,6 +76,7 @@ def test_basic_search(script):
"https://github.com/pypa/warehouse/issues/3717 for more "
"information."),
)
+@pytest.mark.search
def test_multiple_search(script):
"""
Test searching for multiple packages at once.
@@ -88,6 +90,7 @@ def test_multiple_search(script):
assert 'Tools for parsing and using INI-style files' in output.stdout
+@pytest.mark.search
def test_search_missing_argument(script):
"""
Test missing required argument for search
@@ -97,6 +100,7 @@ def test_search_missing_argument(script):
@pytest.mark.network
+@pytest.mark.search
def test_run_method_should_return_success_when_find_packages():
"""
Test SearchCommand.run for found package
@@ -110,6 +114,7 @@ def test_run_method_should_return_success_when_find_packages():
@pytest.mark.network
+@pytest.mark.search
def test_run_method_should_return_no_matches_found_when_does_not_find_pkgs():
"""
Test SearchCommand.run for no matches
@@ -123,6 +128,7 @@ def test_run_method_should_return_no_matches_found_when_does_not_find_pkgs():
@pytest.mark.network
+@pytest.mark.search
def test_search_should_exit_status_code_zero_when_find_packages(script):
"""
Test search exit status code for package found
@@ -132,6 +138,7 @@ def test_search_should_exit_status_code_zero_when_find_packages(script):
@pytest.mark.network
+@pytest.mark.search
def test_search_exit_status_code_when_finds_no_package(script):
"""
Test search exit status code for no matches
@@ -140,6 +147,7 @@ def test_search_exit_status_code_when_finds_no_package(script):
assert result.returncode == NO_MATCHES_FOUND, result.returncode
+@pytest.mark.search
def test_latest_prerelease_install_message(caplog, monkeypatch):
"""
Test documentation for installing pre-release packages is displayed
@@ -168,6 +176,7 @@ def test_latest_prerelease_install_message(caplog, monkeypatch):
assert get_dist.calls == [pretend.call('ni')]
+@pytest.mark.search
def test_search_print_results_should_contain_latest_versions(caplog):
"""
Test that printed search results contain the latest package versions