diff --git a/scripts/tests/test_update_nixpkgs_inputs.py b/scripts/tests/test_update_nixpkgs_inputs.py index 5eb65cec7..69ebd850b 100644 --- a/scripts/tests/test_update_nixpkgs_inputs.py +++ b/scripts/tests/test_update_nixpkgs_inputs.py @@ -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: