Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions scripts/tests/test_update_nixpkgs_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,24 @@ def test_repository_type_follows_and_ref_filters_are_preserved(self):
self.assertEqual(discover(lock_data, "nixos-unstable"), ["unstable"])
self.assertEqual(discover(lock_data, "nixos-24.11"), ["stable"])

def test_current_flake_lock_keeps_the_four_intended_inputs(self):
lock_data = json.loads((ROOT / "flake.lock").read_text())
expected = [
"nixpkgs-25",
"nixpkgs-master",
"nixpkgs-stable",
"nixpkgs-unstable",
]
def test_current_flake_locks_expose_only_their_direct_nixpkgs_inputs(self):
# The root flake intentionally dropped the master/stable inputs (#3327);
# nixpkgs-unstable follows fleet/nixpkgs and is not independently updated.
# The id sub-flake has its own direct nixpkgs input. Keep both lock graphs
# explicit so a valid change to one cannot make this test lie about the other.
flake_locks = {
"root": (ROOT / "flake.lock", ["nixpkgs-25"]),
"pkgs/id": (ROOT / "pkgs" / "id" / "flake.lock", ["nixpkgs"]),
}

for label, script_dir in COPIES.items():
with self.subTest(copy=label):
self.assertEqual(self._discover(script_dir, lock_data), expected)
for copy_label, script_dir in COPIES.items():
discover = runpy.run_path(str(script_dir / "update-nixpkgs-inputs.py"))[
"discover_inputs"
]
for flake_label, (lock_path, expected) in flake_locks.items():
with self.subTest(copy=copy_label, flake=flake_label):
lock_data = json.loads(lock_path.read_text())
self.assertEqual(discover(lock_data, None), expected)


class ScriptTree:
Expand Down