Skip to content

Commit 362cc8f

Browse files
committed
Run ruff check . --select PT022 --fix + manual fix of return type
1 parent 1c2eddd commit 362cc8f

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

tests/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def virtualenv_template(
477477
setuptools_install: Path,
478478
wheel_install: Path,
479479
coverage_install: Path,
480-
) -> Iterator[VirtualEnvironment]:
480+
) -> VirtualEnvironment:
481481
venv_type: VirtualEnvironmentType
482482
if request.config.getoption("--use-venv"):
483483
venv_type = "venv"
@@ -522,7 +522,7 @@ def virtualenv_template(
522522
# it's not reused by mistake from one of the copies.
523523
venv_template = tmpdir / "venv_template"
524524
venv.move(venv_template)
525-
yield venv
525+
return venv
526526

527527

528528
@pytest.fixture(scope="session")
@@ -538,14 +538,14 @@ def factory(tmpdir: Path) -> VirtualEnvironment:
538538
@pytest.fixture
539539
def virtualenv(
540540
virtualenv_factory: Callable[[Path], VirtualEnvironment], tmpdir: Path
541-
) -> Iterator[VirtualEnvironment]:
541+
) -> VirtualEnvironment:
542542
"""
543543
Return a virtual environment which is unique to each test function
544544
invocation created inside of a sub directory of the test function's
545545
temporary directory. The returned object is a
546546
``tests.lib.venv.VirtualEnvironment`` object.
547547
"""
548-
yield virtualenv_factory(tmpdir.joinpath("workspace", "venv"))
548+
return virtualenv_factory(tmpdir.joinpath("workspace", "venv"))
549549

550550

551551
@pytest.fixture(scope="session")

tests/unit/resolution_resolvelib/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222

2323
@pytest.fixture
24-
def finder(data: TestData) -> Iterator[PackageFinder]:
24+
def finder(data: TestData) -> PackageFinder:
2525
session = PipSession()
2626
scope = SearchScope([str(data.packages)], [], False)
2727
collector = LinkCollector(session, scope)
2828
prefs = SelectionPreferences(allow_yanked=False)
2929
finder = PackageFinder.create(collector, prefs)
30-
yield finder
30+
return finder
3131

3232

3333
@pytest.fixture
@@ -53,8 +53,8 @@ def preparer(finder: PackageFinder) -> Iterator[RequirementPreparer]:
5353

5454

5555
@pytest.fixture
56-
def factory(finder: PackageFinder, preparer: RequirementPreparer) -> Iterator[Factory]:
57-
yield Factory(
56+
def factory(finder: PackageFinder, preparer: RequirementPreparer) -> Factory:
57+
return Factory(
5858
finder=finder,
5959
preparer=preparer,
6060
make_install_req=install_req_from_line,
@@ -68,8 +68,8 @@ def factory(finder: PackageFinder, preparer: RequirementPreparer) -> Iterator[Fa
6868

6969

7070
@pytest.fixture
71-
def provider(factory: Factory) -> Iterator[PipProvider]:
72-
yield PipProvider(
71+
def provider(factory: Factory) -> PipProvider:
72+
return PipProvider(
7373
factory=factory,
7474
constraints={},
7575
ignore_dependencies=False,

tests/unit/resolution_resolvelib/test_requirement.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _is_satisfied_by(requirement: Requirement, candidate: Candidate) -> bool:
3232

3333

3434
@pytest.fixture
35-
def test_cases(data: TestData) -> Iterator[List[Tuple[str, str, int]]]:
35+
def test_cases(data: TestData) -> List[Tuple[str, str, int]]:
3636
def _data_file(name: str) -> Path:
3737
return data.packages.joinpath(name)
3838

@@ -61,7 +61,7 @@ def data_url(name: str) -> str:
6161
# TODO: directory, editables
6262
]
6363

64-
yield test_cases
64+
return test_cases
6565

6666

6767
def test_new_resolver_requirement_has_name(

tests/unit/test_network_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212

1313
@pytest.fixture(scope="function")
14-
def cache_tmpdir(tmpdir: Path) -> Iterator[Path]:
14+
def cache_tmpdir(tmpdir: Path) -> Path:
1515
cache_dir = tmpdir.joinpath("cache")
1616
cache_dir.mkdir(parents=True)
17-
yield cache_dir
17+
return cache_dir
1818

1919

2020
class TestSafeFileCache:

0 commit comments

Comments
 (0)