nixos-rebuild-ng: avoid get_qualified_name usage for pathlib.Path

Seems to be broken since Python 3.13.
This commit is contained in:
Thiago Kenji Okada
2025-05-21 12:26:46 +01:00
parent 312fbc61b2
commit 86e3302381
3 changed files with 11 additions and 11 deletions
@@ -1083,8 +1083,8 @@ def test_execute_test_flake(mock_run: Mock, tmp_path: Path) -> None:
@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)
@patch("pathlib.Path.exists", autospec=True, return_value=True)
@patch("pathlib.Path.mkdir", autospec=True)
def test_execute_test_rollback(
mock_path_mkdir: Mock,
mock_path_exists: Mock,
@@ -100,7 +100,7 @@ def test_flake_from_arg(
# None when we do not have /etc/nixos/flake.nix
with patch(
get_qualified_name(m.Path.exists, m),
"pathlib.Path.exists",
autospec=True,
return_value=False,
):
@@ -109,12 +109,12 @@ def test_flake_from_arg(
# None when we have a file in /etc/nixos/flake.nix
with (
patch(
get_qualified_name(m.Path.exists, m),
"pathlib.Path.exists",
autospec=True,
return_value=True,
),
patch(
get_qualified_name(m.Path.is_symlink, m),
"pathlib.Path.is_symlink",
autospec=True,
return_value=False,
),
@@ -130,17 +130,17 @@ def test_flake_from_arg(
with (
patch(
get_qualified_name(m.Path.exists, m),
"pathlib.Path.exists",
autospec=True,
return_value=True,
),
patch(
get_qualified_name(m.Path.is_symlink, m),
"pathlib.Path.is_symlink",
autospec=True,
return_value=True,
),
patch(
get_qualified_name(m.Path.resolve, m),
"pathlib.Path.resolve",
autospec=True,
return_value=Path("/path/to/flake.nix"),
),
@@ -161,7 +161,7 @@ def test_flake_from_arg(
)
@patch(get_qualified_name(m.Path.mkdir, m), autospec=True)
@patch("pathlib.Path.mkdir", autospec=True)
def test_profile_from_arg(mock_mkdir: Mock) -> None:
assert m.Profile.from_arg("system") == m.Profile(
"system",
@@ -809,7 +809,7 @@ def test_switch_to_configuration_with_systemd_run(
@patch(
get_qualified_name(n.Path.glob, n),
"pathlib.Path.glob",
autospec=True,
return_value=[
Path("/nix/var/nix/profiles/per-user/root/channels/nixos"),
@@ -817,7 +817,7 @@ def test_switch_to_configuration_with_systemd_run(
Path("/nix/var/nix/profiles/per-user/root/channels/home-manager"),
],
)
@patch(get_qualified_name(n.Path.is_dir, n), autospec=True, return_value=True)
@patch("pathlib.Path.is_dir", autospec=True, return_value=True)
def test_upgrade_channels(mock_is_dir: Mock, mock_glob: Mock) -> None:
with patch(get_qualified_name(n.run_wrapper, n), autospec=True) as mock_run:
n.upgrade_channels(False)