From 00fbe9e61142292c4dbeefd97cc2c08ca39432c8 Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sat, 23 Mar 2024 21:12:06 +0000 Subject: [PATCH] update pytest.mark.network markers --- tests/inspection/test_info.py | 4 ---- tests/installation/test_chef.py | 2 -- tests/installation/test_executor.py | 5 ----- tests/integration/test_utils_vcs_git.py | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/inspection/test_info.py b/tests/inspection/test_info.py index 377aba2e902..73fa890bd6c 100644 --- a/tests/inspection/test_info.py +++ b/tests/inspection/test_info.py @@ -315,7 +315,6 @@ def test_info_setup_simple(mocker: MockerFixture, demo_setup: Path) -> None: demo_check_info(info, requires_dist={"package"}) -@pytest.mark.network def test_info_setup_complex(demo_setup_complex: Path) -> None: info = PackageInfo.from_directory(demo_setup_complex) demo_check_info(info, requires_dist={"package"}) @@ -334,7 +333,6 @@ def test_info_setup_complex_pep517_error( PackageInfo.from_directory(demo_setup_complex) -@pytest.mark.network def test_info_setup_complex_pep517_legacy( demo_setup_complex_pep517_legacy: Path, ) -> None: @@ -342,14 +340,12 @@ def test_info_setup_complex_pep517_legacy( demo_check_info(info, requires_dist={"package"}) -@pytest.mark.network def test_info_setup_complex_calls_script(demo_setup_complex_calls_script: Path) -> None: """Building the project requires calling a script from its build_requires.""" info = PackageInfo.from_directory(demo_setup_complex_calls_script) demo_check_info(info, requires_dist={"package"}) -@pytest.mark.network @pytest.mark.parametrize("missing", ["version", "name"]) def test_info_setup_missing_mandatory_should_trigger_pep517( mocker: MockerFixture, source_dir: Path, missing: str diff --git a/tests/installation/test_chef.py b/tests/installation/test_chef.py index 62504e1e36d..ffe0e06b3bd 100644 --- a/tests/installation/test_chef.py +++ b/tests/installation/test_chef.py @@ -80,7 +80,6 @@ def test_prepare_directory( os.unlink(wheel) -@pytest.mark.network def test_prepare_directory_with_extensions( config: Config, config_cache_dir: Path, @@ -126,7 +125,6 @@ def test_prepare_directory_editable( os.unlink(wheel) -@pytest.mark.network def test_prepare_directory_script( config: Config, config_cache_dir: Path, diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index 1be9c22fbd7..8a6a6d3141f 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -1547,11 +1547,6 @@ def test_executor_known_hashes( io: BufferedIO, fixture_dir: FixtureDirGetter, ) -> None: - # when installing sdist, an isolated build environment is required to extract metadata - # this will install any build system requirements into the environment, to avoid failures when - # network is not available we enable mock_file_downloads fixture here - # see: https://github.com/python-poetry/poetry/issues/9114 - package_source_url: Path = ( fixture_dir("distributions") / "demo-0.1.0.tar.gz" ).resolve() diff --git a/tests/integration/test_utils_vcs_git.py b/tests/integration/test_utils_vcs_git.py index 069566a22c5..14a0d0f292b 100644 --- a/tests/integration/test_utils_vcs_git.py +++ b/tests/integration/test_utils_vcs_git.py @@ -134,6 +134,7 @@ def test_use_system_git_client_from_environment_variables() -> None: assert Git.is_using_legacy_client() +@pytest.mark.network def test_git_local_info( source_url: str, remote_refs: FetchPackResult, remote_default_ref: bytes ) -> None: @@ -143,6 +144,7 @@ def test_git_local_info( assert info.revision == remote_refs.refs[remote_default_ref].decode("utf-8") +@pytest.mark.network @pytest.mark.parametrize( "specification", [{}, {"revision": "HEAD"}, {"branch": "HEAD"}] ) @@ -163,6 +165,7 @@ def test_git_clone_default_branch_head( spy.assert_called() +@pytest.mark.network def test_git_clone_fails_for_non_existent_branch(source_url: str) -> None: branch = uuid.uuid4().hex @@ -172,6 +175,7 @@ def test_git_clone_fails_for_non_existent_branch(source_url: str) -> None: assert f"Failed to clone {source_url} at '{branch}'" in str(e.value) +@pytest.mark.network def test_git_clone_fails_for_non_existent_revision(source_url: str) -> None: revision = sha1(uuid.uuid4().bytes).hexdigest() @@ -193,11 +197,13 @@ def assert_version(repo: Repo, expected_revision: str) -> None: assert version == REVISION_TO_VERSION_MAP[revision] +@pytest.mark.network def test_git_clone_when_branch_is_ref(source_url: str) -> None: with Git.clone(url=source_url, branch="refs/heads/0.1") as repo: assert_version(repo, BRANCH_TO_REVISION_MAP["0.1"]) +@pytest.mark.network @pytest.mark.parametrize("branch", [*BRANCH_TO_REVISION_MAP.keys()]) def test_git_clone_branch( source_url: str, remote_refs: FetchPackResult, branch: str @@ -206,12 +212,14 @@ def test_git_clone_branch( assert_version(repo, BRANCH_TO_REVISION_MAP[branch]) +@pytest.mark.network @pytest.mark.parametrize("tag", [*TAG_TO_REVISION_MAP.keys()]) def test_git_clone_tag(source_url: str, remote_refs: FetchPackResult, tag: str) -> None: with Git.clone(url=source_url, tag=tag) as repo: assert_version(repo, TAG_TO_REVISION_MAP[tag]) +@pytest.mark.network def test_git_clone_multiple_times( source_url: str, remote_refs: FetchPackResult ) -> None: @@ -220,6 +228,7 @@ def test_git_clone_multiple_times( assert_version(repo, revision) +@pytest.mark.network def test_git_clone_revision_is_branch( source_url: str, remote_refs: FetchPackResult ) -> None: @@ -227,6 +236,7 @@ def test_git_clone_revision_is_branch( assert_version(repo, BRANCH_TO_REVISION_MAP["0.1"]) +@pytest.mark.network def test_git_clone_revision_is_ref( source_url: str, remote_refs: FetchPackResult ) -> None: @@ -234,6 +244,7 @@ def test_git_clone_revision_is_ref( assert_version(repo, BRANCH_TO_REVISION_MAP["0.1"]) +@pytest.mark.network @pytest.mark.parametrize( ("revision", "expected_revision"), [ @@ -249,6 +260,7 @@ def test_git_clone_revision_is_tag( assert_version(repo, expected_revision) +@pytest.mark.network def test_git_clone_clones_submodules(source_url: str) -> None: with Git.clone(url=source_url) as repo: submodule_package_directory = ( @@ -260,6 +272,7 @@ def test_git_clone_clones_submodules(source_url: str) -> None: assert len(list(submodule_package_directory.glob("*"))) > 1 +@pytest.mark.network def test_git_clone_clones_submodules_with_relative_urls(source_url: str) -> None: with Git.clone(url=source_url, branch="relative_submodule") as repo: submodule_package_directory = ( @@ -271,6 +284,7 @@ def test_git_clone_clones_submodules_with_relative_urls(source_url: str) -> None assert len(list(submodule_package_directory.glob("*"))) > 1 +@pytest.mark.network def test_git_clone_clones_submodules_with_relative_urls_and_explicit_base( source_url: str, ) -> None: @@ -284,6 +298,7 @@ def test_git_clone_clones_submodules_with_relative_urls_and_explicit_base( assert len(list(submodule_package_directory.glob("*"))) > 1 +@pytest.mark.network def test_system_git_fallback_on_http_401( mocker: MockerFixture, source_url: str, @@ -361,6 +376,7 @@ def test_configured_repository_http_auth( spy_get_transport_and_path.assert_called_once() +@pytest.mark.network def test_username_password_parameter_is_not_passed_to_dulwich( mocker: MockerFixture, source_url: str, config: Config ) -> None: @@ -387,6 +403,7 @@ def test_username_password_parameter_is_not_passed_to_dulwich( spy_get_transport_and_path.assert_called_once() +@pytest.mark.network def test_system_git_called_when_configured( mocker: MockerFixture, source_url: str, use_system_git_client: None ) -> None: @@ -407,6 +424,7 @@ def test_system_git_called_when_configured( ) +@pytest.mark.network def test_relative_submodules_with_ssh( source_url: str, tmpdir: Path, mocker: MockerFixture ) -> None: