mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-06 13:03:34 +00:00
nixos-rebuild-ng: add test to nixos-rebuild build
This commit is contained in:
parent
debea81ba7
commit
c6e9bd02ca
@ -445,6 +445,35 @@ def test_execute_switch_rollback(mock_run: Any, tmp_path: Path) -> None:
|
||||
)
|
||||
|
||||
|
||||
@patch(get_qualified_name(nr.process.subprocess.run), autospec=True)
|
||||
def test_execute_build(mock_run: Any, tmp_path: Path) -> None:
|
||||
config_path = tmp_path / "test"
|
||||
config_path.touch()
|
||||
mock_run.side_effect = [
|
||||
# nixos_build_flake
|
||||
CompletedProcess([], 0, str(config_path)),
|
||||
]
|
||||
|
||||
nr.execute(["nixos-rebuild", "build", "--no-flake", "--fast"])
|
||||
|
||||
assert mock_run.call_count == 1
|
||||
mock_run.assert_has_calls(
|
||||
[
|
||||
call(
|
||||
[
|
||||
"nix-build",
|
||||
"<nixpkgs/nixos>",
|
||||
"--attr",
|
||||
"config.system.build.toplevel",
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@patch(get_qualified_name(nr.process.subprocess.run), autospec=True)
|
||||
@patch(get_qualified_name(nr.nix.Path.exists, nr.nix), autospec=True, return_value=True)
|
||||
@patch(get_qualified_name(nr.nix.Path.mkdir, nr.nix), autospec=True)
|
||||
|
Loading…
Reference in New Issue
Block a user