Skip to content

Commit e6db004

Browse files
authored
Mark more tests as requiring network (#13378)
Apply the network marker to more tests that attempt to install packages from PyPI and other online sources, and therefore fail without Internet access. To reproduce: nox -e test-3.13 sudo unshare -n sh -c "ifconfig lo up && sudo -u $USER sh -c \". .nox/test-3-13/bin/activate && pytest -n auto -m 'not network'\""
1 parent 8b507f9 commit e6db004

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

news/13378.bugfix.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix missing ``network`` test markings, making the suite pass in offline
2+
environments again.

tests/functional/test_config_settings.py

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from pathlib import Path
66
from zipfile import ZipFile
77

8+
import pytest
9+
810
from pip._internal.utils.urls import path_to_url
911

1012
from tests.lib import PipTestEnvironment, create_basic_sdist_for_package
@@ -180,6 +182,7 @@ def test_backend_sees_config_via_constraint(script: PipTestEnvironment) -> None:
180182
assert json.loads(output) == {"FOO": "Hello"}
181183

182184

185+
@pytest.mark.network
183186
def test_backend_sees_config_via_sdist(script: PipTestEnvironment) -> None:
184187
name, version, project_dir = make_project(script.scratch_path)
185188
dists_dir = script.scratch_path / "dists"

tests/functional/test_install.py

+2
Original file line numberDiff line numberDiff line change
@@ -1919,6 +1919,7 @@ def test_double_install(script: PipTestEnvironment) -> None:
19191919
assert msg not in result.stderr
19201920

19211921

1922+
@pytest.mark.network
19221923
def test_double_install_fail(
19231924
script: PipTestEnvironment, resolver_variant: ResolverVariant
19241925
) -> None:
@@ -2679,6 +2680,7 @@ def test_install_pip_prints_req_chain_pypi(script: PipTestEnvironment) -> None:
26792680

26802681

26812682
@pytest.mark.parametrize("common_prefix", ["", "linktest-1.0/"])
2683+
@pytest.mark.network
26822684
def test_install_sdist_links(script: PipTestEnvironment, common_prefix: str) -> None:
26832685
"""
26842686
Test installing an sdist with hard and symbolic links.

tests/functional/test_install_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ def flags(
417417
return flags
418418

419419

420+
@pytest.mark.network
420421
def test_prompt_for_keyring_if_needed(
421422
data: TestData,
422423
cert_factory: CertFactory,

tests/functional/test_lock.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import textwrap
22
from pathlib import Path
33

4+
import pytest
5+
46
from pip._internal.utils.compat import tomllib
57
from pip._internal.utils.urls import path_to_url
68

@@ -181,6 +183,7 @@ def test_lock_local_editable_with_dep(
181183
]
182184

183185

186+
@pytest.mark.network
184187
def test_lock_vcs(script: PipTestEnvironment, shared_data: TestData) -> None:
185188
result = script.pip(
186189
"lock",
@@ -205,6 +208,7 @@ def test_lock_vcs(script: PipTestEnvironment, shared_data: TestData) -> None:
205208
]
206209

207210

211+
@pytest.mark.network
208212
def test_lock_archive(script: PipTestEnvironment, shared_data: TestData) -> None:
209213
result = script.pip(
210214
"lock",

0 commit comments

Comments
 (0)