Skip to content

Commit 9e26bdc

Browse files
committed
Manual fixes of PT018
1 parent 6c86c96 commit 9e26bdc

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

tests/functional/test_install.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,13 @@ def test_pep518_refuses_conflicting_requires(
105105
result = script.pip_install_local(
106106
"-f", script.scratch_path, project_dir, expect_error=True
107107
)
108+
assert result.returncode != 0
108109
assert (
109-
result.returncode != 0
110-
and (
111110
f"Some build dependencies for {project_dir.as_uri()} conflict "
112111
"with PEP 517/518 supported "
113112
"requirements: setuptools==1.0 is incompatible with "
114113
"setuptools>=40.8.0."
115-
)
116-
in result.stderr
117-
), str(result)
114+
) in result.stderr, str(result)
118115

119116

120117
def test_pep518_refuses_invalid_requires(
@@ -2309,10 +2306,8 @@ def test_error_all_yanked_files_and_no_pin(
23092306
expect_error=True,
23102307
)
23112308
# Make sure an error is raised
2312-
assert (
2313-
result.returncode == 1
2314-
and "ERROR: No matching distribution found for simple\n" in result.stderr
2315-
), str(result)
2309+
assert result.returncode == 1
2310+
assert "ERROR: No matching distribution found for simple\n" in result.stderr, str(result)
23162311

23172312

23182313
@pytest.mark.parametrize(

tests/functional/test_pep517.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ def test_conflicting_pep517_backend_requirements(
164164
"dependencies: simplewheel==1.0 is incompatible with "
165165
"simplewheel==2.0."
166166
)
167-
assert result.returncode != 0 and msg in result.stderr, str(result)
167+
assert result.returncode != 0
168+
assert msg in result.stderr, str(result)
168169

169170

170171
def test_no_check_build_deps(
@@ -209,7 +210,8 @@ def test_validate_missing_pep517_backend_requirements(
209210
f"Some build dependencies for {project_dir.as_uri()} are missing: "
210211
"'simplewheel==1.0', 'test_backend'."
211212
)
212-
assert result.returncode != 0 and msg in result.stderr, str(result)
213+
assert result.returncode != 0
214+
assert msg in result.stderr, str(result)
213215

214216

215217
def test_validate_conflicting_pep517_backend_requirements(
@@ -236,7 +238,8 @@ def test_validate_conflicting_pep517_backend_requirements(
236238
"dependencies: simplewheel==2.0 is incompatible with "
237239
"simplewheel==1.0."
238240
)
239-
assert result.returncode != 0 and msg in result.stderr, str(result)
241+
assert result.returncode != 0
242+
assert msg in result.stderr, str(result)
240243

241244

242245
def test_pep517_backend_requirements_satisfied_by_prerelease(

tests/unit/test_collector.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,9 @@ def test_collect_sources__file_expand_dir(data: TestData) -> None:
880880
project_name="",
881881
candidates_from_page=None, # type: ignore[arg-type]
882882
)
883-
assert (
884-
not sources.index_urls
885-
and len(sources.find_links) == 1
886-
and isinstance(sources.find_links[0], _FlatDirectorySource)
887-
), (
883+
assert not sources.index_urls
884+
assert len(sources.find_links) == 1
885+
assert isinstance(sources.find_links[0], _FlatDirectorySource), (
888886
"Directory source should have been found "
889887
f"at find-links url: {data.find_links}"
890888
)
@@ -909,11 +907,9 @@ def test_collect_sources__file_not_find_link(data: TestData) -> None:
909907
# Shouldn't be used.
910908
candidates_from_page=None, # type: ignore[arg-type]
911909
)
912-
assert (
913-
not sources.find_links
914-
and len(sources.index_urls) == 1
915-
and isinstance(sources.index_urls[0], _IndexDirectorySource)
916-
), "Directory specified as index should be treated as a page"
910+
assert not sources.find_links
911+
assert len(sources.index_urls) == 1
912+
assert isinstance(sources.index_urls[0], _IndexDirectorySource), "Directory specified as index should be treated as a page"
917913

918914

919915
def test_collect_sources__non_existing_path() -> None:
@@ -934,9 +930,8 @@ def test_collect_sources__non_existing_path() -> None:
934930
project_name=None, # type: ignore[arg-type]
935931
candidates_from_page=None, # type: ignore[arg-type]
936932
)
937-
assert not sources.index_urls and sources.find_links == [
938-
None
939-
], "Nothing should have been found"
933+
assert not sources.index_urls
934+
assert sources.find_links == [None], "Nothing should have been found"
940935

941936

942937
def check_links_include(links: List[Link], names: List[str]) -> None:

0 commit comments

Comments
 (0)