File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
conda_lock/lockfile/v2prelim Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def merge(self, other: "Optional[Lockfile]") -> "Lockfile":
65
65
66
66
# Resort the conda packages topologically
67
67
final_package = self ._toposort (package )
68
- return Lockfile (package = final_package , metadata = other .metadata | self .metadata )
68
+ return Lockfile (package = final_package , metadata = self .metadata | other .metadata )
69
69
70
70
def toposort_inplace (self ) -> None :
71
71
self .package = self ._toposort (self .package )
Original file line number Diff line number Diff line change @@ -2729,3 +2729,30 @@ def test_pip_full_whl_url(
2729
2729
typing_extensions_dep .hash .sha256
2730
2730
== "8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"
2731
2731
)
2732
+
2733
+
2734
+ def test_when_merging_lockfiles_content_hashes_are_updated (
2735
+ conda_exe : str ,
2736
+ monkeypatch : "pytest.MonkeyPatch" ,
2737
+ tmp_path : Path ,
2738
+ ):
2739
+ work_path = clone_test_dir (name = "test-update" , tmp_path = tmp_path )
2740
+ monkeypatch .chdir (work_path )
2741
+ run_lock (
2742
+ environment_files = [work_path / "environment-preupdate.yml" ],
2743
+ conda_exe = str (conda_exe ),
2744
+ platforms = ["linux-64" ],
2745
+ )
2746
+
2747
+ def get_content_hashes_for_lock_file (lock_file : Path ) -> typing .Dict [str , str ]:
2748
+ lock_file_dict = yaml .safe_load (lock_file .read_text ())
2749
+ return lock_file_dict ["metadata" ]["content_hash" ]
2750
+
2751
+ preupdate_hashes = get_content_hashes_for_lock_file (work_path / "conda-lock.yml" )
2752
+ run_lock (
2753
+ environment_files = [work_path / "environment-postupdate.yml" ],
2754
+ conda_exe = str (conda_exe ),
2755
+ platforms = ["linux-64" ],
2756
+ )
2757
+ postupdate_hashes = get_content_hashes_for_lock_file (work_path / "conda-lock.yml" )
2758
+ assert preupdate_hashes != postupdate_hashes
You can’t perform that action at this time.
0 commit comments