From 1f9432bc4294388e8f3a4c3b15cdf841d3f9366e Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Fri, 3 Jan 2025 15:49:06 -0500 Subject: [PATCH] chore(test): enable known external network calls Not using the `network` marker as a filter - there are currently 133, and not all of them are actually making network calls. Signed-off-by: Mike Fiedler --- tests/functional/test_index.py | 2 ++ tests/unit/test_network_lazy_wheel.py | 3 +++ tests/unit/test_network_session.py | 1 + tests/unit/test_req.py | 2 ++ tests/unit/test_req_file.py | 1 + 5 files changed, 9 insertions(+) diff --git a/tests/functional/test_index.py b/tests/functional/test_index.py index 5a3c27bac9d..67d12419804 100644 --- a/tests/functional/test_index.py +++ b/tests/functional/test_index.py @@ -50,6 +50,7 @@ def test_list_all_versions_search_with_pre(script: PipTestEnvironment) -> None: ) +@pytest.mark.enable_socket @pytest.mark.network def test_list_all_versions_returns_no_matches_found_when_name_not_exact() -> None: """ @@ -63,6 +64,7 @@ def test_list_all_versions_returns_no_matches_found_when_name_not_exact() -> Non assert status == ERROR +@pytest.mark.enable_socket @pytest.mark.network def test_list_all_versions_returns_matches_found_when_name_is_exact() -> None: """ diff --git a/tests/unit/test_network_lazy_wheel.py b/tests/unit/test_network_lazy_wheel.py index 5d97e9e3202..5156fe13e8a 100644 --- a/tests/unit/test_network_lazy_wheel.py +++ b/tests/unit/test_network_lazy_wheel.py @@ -42,6 +42,7 @@ def mypy_whl_no_range(mock_server: MockServer, shared_data: TestData) -> Iterato mock_server.stop() +@pytest.mark.enable_socket @pytest.mark.network def test_dist_from_wheel_url(session: PipSession) -> None: """Test if the acquired distribution contain correct information.""" @@ -53,6 +54,7 @@ def test_dist_from_wheel_url(session: PipSession) -> None: assert {str(d) for d in dist.iter_dependencies(extras)} == MYPY_0_782_REQS +@pytest.mark.enable_socket def test_dist_from_wheel_url_no_range( session: PipSession, mypy_whl_no_range: str ) -> None: @@ -61,6 +63,7 @@ def test_dist_from_wheel_url_no_range( dist_from_wheel_url("mypy", mypy_whl_no_range, session) +@pytest.mark.enable_socket @pytest.mark.network def test_dist_from_wheel_url_not_zip(session: PipSession) -> None: """Test handling with the given URL does not point to a ZIP.""" diff --git a/tests/unit/test_network_session.py b/tests/unit/test_network_session.py index fd00d5c606c..ebf0149c664 100644 --- a/tests/unit/test_network_session.py +++ b/tests/unit/test_network_session.py @@ -255,6 +255,7 @@ def warning(self, *args: Any, **kwargs: Any) -> None: assert actual_level == "WARNING" assert "is not a trusted or secure host" in actual_message + @pytest.mark.enable_socket @pytest.mark.network def test_proxy(self, proxy: Optional[str]) -> None: session = PipSession(trusted_hosts=[]) diff --git a/tests/unit/test_req.py b/tests/unit/test_req.py index e243a718725..dfcf9ab3e8e 100644 --- a/tests/unit/test_req.py +++ b/tests/unit/test_req.py @@ -365,6 +365,7 @@ def test_download_info_find_links(self, data: TestData) -> None: assert isinstance(req.download_info.info, ArchiveInfo) assert req.download_info.info.hash + @pytest.mark.enable_socket @pytest.mark.network def test_download_info_index_url(self) -> None: """Test that download_info is set for requirements via index.""" @@ -377,6 +378,7 @@ def test_download_info_index_url(self) -> None: assert req.download_info assert isinstance(req.download_info.info, ArchiveInfo) + @pytest.mark.enable_socket @pytest.mark.network def test_download_info_web_archive(self) -> None: """Test that download_info is set for requirements from a web archive.""" diff --git a/tests/unit/test_req_file.py b/tests/unit/test_req_file.py index 1cc030681db..ae02fad1ed5 100644 --- a/tests/unit/test_req_file.py +++ b/tests/unit/test_req_file.py @@ -725,6 +725,7 @@ def test_variant5( class TestParseRequirements: """tests for `parse_reqfile`""" + @pytest.mark.enable_socket @pytest.mark.network def test_remote_reqs_parse(self) -> None: """