Skip to content

Commit

Permalink
Manually fix PT013
Browse files Browse the repository at this point in the history
  • Loading branch information
notatallshaw committed Aug 6, 2024
1 parent 612d1f1 commit b4ba735
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions tests/functional/test_fast_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Iterable

from pip._vendor.packaging.utils import canonicalize_name
from pytest import mark
import pytest

from pip._internal.utils.misc import hash_file
from tests.lib import PipTestEnvironment, TestData, TestPipResult
Expand All @@ -30,8 +30,8 @@ def assert_installed(script: PipTestEnvironment, names: str) -> None:
assert installed.issuperset(map(canonicalize_name, names))


@mark.network
@mark.parametrize(
@pytest.mark.network
@pytest.mark.parametrize(
"requirement, expected",
[
("Paste==3.4.2", ("Paste", "six")),
Expand All @@ -45,8 +45,8 @@ def test_install_from_pypi(
assert_installed(script, expected)


@mark.network
@mark.parametrize(
@pytest.mark.network
@pytest.mark.parametrize(
"requirement, expected",
[
("Paste==3.4.2", ("Paste-3.4.2-*.whl", "six-*.whl")),
Expand All @@ -61,7 +61,7 @@ def test_download_from_pypi(
assert all(fnmatch.filter(created, f) for f in expected)


@mark.network
@pytest.mark.network
def test_build_wheel_with_deps(data: TestData, script: PipTestEnvironment) -> None:
result = pip(script, "wheel", os.fspath(data.packages / "requiresPaste"))
created = [basename(f) for f in result.files_created]
Expand All @@ -70,7 +70,7 @@ def test_build_wheel_with_deps(data: TestData, script: PipTestEnvironment) -> No
assert fnmatch.filter(created, "six-*.whl")


@mark.network
@pytest.mark.network
def test_require_hash(script: PipTestEnvironment, tmp_path: pathlib.Path) -> None:
reqs = tmp_path / "requirements.txt"
reqs.write_text(
Expand All @@ -91,7 +91,7 @@ def test_require_hash(script: PipTestEnvironment, tmp_path: pathlib.Path) -> Non
assert fnmatch.filter(created, "idna-2.10*")


@mark.network
@pytest.mark.network
def test_hash_mismatch(script: PipTestEnvironment, tmp_path: pathlib.Path) -> None:
reqs = tmp_path / "requirements.txt"
reqs.write_text("idna==2.10 --hash=sha256:irna")
Expand All @@ -105,7 +105,7 @@ def test_hash_mismatch(script: PipTestEnvironment, tmp_path: pathlib.Path) -> No
assert "DO NOT MATCH THE HASHES" in result.stderr


@mark.network
@pytest.mark.network
def test_hash_mismatch_existing_download_for_metadata_only_wheel(
script: PipTestEnvironment, tmp_path: pathlib.Path
) -> None:
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/test_network_lazy_wheel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Iterator

import pytest
from pip._vendor.packaging.version import Version
from pytest import fixture, mark, raises

from pip._internal.exceptions import InvalidWheel
from pip._internal.network.lazy_wheel import (
Expand All @@ -25,12 +25,12 @@
}


@fixture
@pytest.fixture
def session() -> PipSession:
return PipSession()


@fixture
@pytest.fixture
def mypy_whl_no_range(mock_server: MockServer, shared_data: TestData) -> Iterator[str]:
mypy_whl = shared_data.packages / "mypy-0.782-py3-none-any.whl"
mock_server.set_responses([file_response(mypy_whl)])
Expand All @@ -40,7 +40,7 @@ def mypy_whl_no_range(mock_server: MockServer, shared_data: TestData) -> Iterato
mock_server.stop()


@mark.network
@pytest.mark.network
def test_dist_from_wheel_url(session: PipSession) -> None:
"""Test if the acquired distribution contain correct information."""
dist = dist_from_wheel_url("mypy", MYPY_0_782_WHL, session)
Expand All @@ -55,12 +55,12 @@ def test_dist_from_wheel_url_no_range(
session: PipSession, mypy_whl_no_range: str
) -> None:
"""Test handling when HTTP range requests are not supported."""
with raises(HTTPRangeRequestUnsupported):
with pytest.raises(HTTPRangeRequestUnsupported):
dist_from_wheel_url("mypy", mypy_whl_no_range, session)


@mark.network
@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."""
with raises(InvalidWheel):
with pytest.raises(InvalidWheel):
dist_from_wheel_url("python", "https://www.python.org/", session)

0 comments on commit b4ba735

Please sign in to comment.