Skip to content

Commit

Permalink
Switch tests to use Pydantic model_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Nov 25, 2024
1 parent 62898e4 commit 0ce3728
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,17 +1989,17 @@ def test_aggregate_lock_specs_invalid_pip_repos():
sources=[],
)

spec_a_b = base_spec.copy(update={"pip_repositories": [repo_a, repo_b]})
spec_a_b = base_spec.model_copy(update={"pip_repositories": [repo_a, repo_b]})
agg_spec = aggregate_lock_specs([base_spec, spec_a_b, spec_a_b], platforms=[])
assert agg_spec.pip_repositories == spec_a_b.pip_repositories

# swap the order of the two repositories, which is an error
spec_b_a = base_spec.copy(update={"pip_repositories": [repo_b, repo_a]})
spec_b_a = base_spec.model_copy(update={"pip_repositories": [repo_b, repo_a]})
with pytest.raises(ChannelAggregationError):
agg_spec = aggregate_lock_specs([base_spec, spec_a_b, spec_b_a], platforms=[])

# We can combine ["a"] with ["b", "a"], but not with ["a", "b"].
spec_a = base_spec.copy(update={"pip_repositories": [repo_a]})
spec_a = base_spec.model_copy(update={"pip_repositories": [repo_a]})
aggregate_lock_specs([base_spec, spec_a, spec_b_a], platforms=[])
with pytest.raises(ChannelAggregationError):
aggregate_lock_specs([base_spec, spec_a, spec_a_b], platforms=[])
Expand Down

0 comments on commit 0ce3728

Please sign in to comment.