File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -255,13 +255,23 @@ def drop_caret_bound_from_dependency(dependency: "Dependency") -> "Dependency":
255
255
If the dependency does not use a caret constraint to specify its upper bound,
256
256
it will not be changed but a new copy will be returned.
257
257
"""
258
+ # If the constraint is empty, there is nothing to do
259
+ if not dependency .pretty_constraint :
260
+ return dependency
261
+
258
262
new_version = mutate_constraint (
259
263
dependency .pretty_constraint , drop_upper_bound_from_caret_constraint
260
264
)
261
265
262
266
# Copy the existing dependency to retain as much information as possible
263
267
new_dependency = copy (dependency )
264
268
269
+ # If the constraint is empty, assignment will fail
270
+ if not new_version :
271
+ raise ValueError (
272
+ f"Updating constraint for { dependency } resulted in an empty version"
273
+ )
274
+
265
275
# Update the constraint to the new version
266
276
# The property setter parses this into a proper constraint type
267
277
new_dependency .constraint = new_version # type: ignore
Original file line number Diff line number Diff line change @@ -335,6 +335,22 @@ def test_dependency_with_additional_options(relax_command: PoetryCommandTester):
335
335
assert relax_command .status_code == 0
336
336
337
337
338
+ def test_dependency_with_git_url (relax_command : PoetryCommandTester ):
339
+ with update_pyproject () as pyproject :
340
+ pyproject ["tool" ]["poetry" ]["dependencies" ]["test" ] = {
341
+ "git" : "https://github.com/zanieb/test.git"
342
+ }
343
+
344
+ with assert_pyproject_matches () as expected_config :
345
+ relax_command .execute ()
346
+
347
+ expected_config ["tool" ]["poetry" ]["dependencies" ]["test" ] = {
348
+ "git" : "https://github.com/zanieb/test.git"
349
+ }
350
+
351
+ assert relax_command .status_code == 0
352
+
353
+
338
354
def test_dependency_with_multiple_conditional_versions (
339
355
relax_command : PoetryCommandTester ,
340
356
):
You can’t perform that action at this time.
0 commit comments