Skip to content

Commit 3f4c07e

Browse files
committed
Resolve azure-devops dependency
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 34e018d commit 3f4c07e

File tree

4 files changed

+2094
-4
lines changed

4 files changed

+2094
-4
lines changed

src/python_inspector/resolution.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ def is_valid_version(
192192
"""
193193
Return True if the parsed_version is valid for the given identifier.
194194
"""
195-
if (
196-
any(parsed_version not in r.specifier for r in requirements[identifier])
197-
or parsed_version in bad_versions
198-
):
195+
if parsed_version in bad_versions:
196+
return False
197+
if any(parsed_version not in r.specifier for r in requirements[identifier]):
198+
if parsed_version.is_prerelease:
199+
return True
199200
return False
200201
return True
201202

@@ -504,6 +505,8 @@ def find_matches(
504505

505506
def is_satisfied_by(self, requirement: Requirement, candidate: Candidate) -> bool:
506507
"""Whether the given requirement can be satisfied by a candidate. Overridden."""
508+
if candidate.version.is_prerelease:
509+
return True
507510
return candidate.version in requirement.specifier
508511

509512
def _iter_dependencies(self, candidate: Candidate) -> Generator[Requirement, None, None]:

tests/data/azure-devops.req-expected.json

Lines changed: 2066 additions & 0 deletions
Large diffs are not rendered by default.

tests/data/azure-devops.req.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
azure-devops
2+
azure-storage-blob
3+
click

tests/test_cli.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,24 @@ def test_cli_with_environment_marker_and_complex_ranges():
162162
)
163163

164164

165+
@pytest.mark.online
166+
def test_cli_with_azure_devops():
167+
requirements_file = test_env.get_test_loc("azure-devops.req.txt")
168+
expected_file = test_env.get_test_loc("azure-devops.req-expected.json", must_exist=False)
169+
extra_options = [
170+
"--operating-system",
171+
"linux",
172+
"--python-version",
173+
"38",
174+
]
175+
check_requirements_resolution(
176+
requirements_file=requirements_file,
177+
expected_file=expected_file,
178+
extra_options=extra_options,
179+
regen=REGEN_TEST_FIXTURES,
180+
)
181+
182+
165183
@pytest.mark.online
166184
def test_cli_with_multiple_index_url_and_tilde_req_with_max_rounds():
167185
expected_file = test_env.get_test_loc("tilde_req-expected.json", must_exist=False)

0 commit comments

Comments
 (0)