style: apply ruff format across the tree; refresh moved-module doc refs
Bring 14 files that predated the ruff-format run into line with the configured formatter (line-length 100); provably formatting-only (ruff format of HEAD == working tree, and ruff format is semantics-preserving). Also refresh two lim.image.tor._KEYGEN_SCRIPT doc references in tor_harness.py to lim.image.initramfs.keygen after the module moved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -24,9 +24,7 @@ def test_every_command_dispatches_to_its_function(monkeypatch):
|
||||
def test_needs_root_command_requests_root(monkeypatch):
|
||||
escalated = []
|
||||
monkeypatch.setattr(system, "ensure_root", lambda: escalated.append(True))
|
||||
monkeypatch.setitem(
|
||||
cli.COMMANDS, "backup", Command(lambda: None, "d", needs_root=True)
|
||||
)
|
||||
monkeypatch.setitem(cli.COMMANDS, "backup", Command(lambda: None, "d", needs_root=True))
|
||||
cli.main(["--type", "backup", "--auto-confirm"])
|
||||
assert escalated == [True]
|
||||
|
||||
|
||||
@@ -20,9 +20,7 @@ def test_storage_target_derives_all_paths():
|
||||
assert target.partition_path == "/dev/sdb1"
|
||||
|
||||
|
||||
def test_single_drive_setup_command_sequence(
|
||||
fake_runner, answers, block_devices, monkeypatch
|
||||
):
|
||||
def test_single_drive_setup_command_sequence(fake_runner, answers, block_devices, monkeypatch):
|
||||
monkeypatch.setattr("lim.system.real_user", lambda: "kevin")
|
||||
answers("sdb", "N") # device name, skip overwrite
|
||||
|
||||
|
||||
@@ -58,10 +58,19 @@ def test_rsync_command_uses_delete_only_for_directories():
|
||||
directory_op = sync.SyncOperation("src/", "dst/", "backup", is_directory=True)
|
||||
file_op = sync.SyncOperation("src", "dst", "backup", is_directory=False)
|
||||
assert sync.rsync_command(directory_op) == [
|
||||
"rsync", "-abcEPuvW", "--delete", "--backup-dir=backup", "src/", "dst/"
|
||||
"rsync",
|
||||
"-abcEPuvW",
|
||||
"--delete",
|
||||
"--backup-dir=backup",
|
||||
"src/",
|
||||
"dst/",
|
||||
]
|
||||
assert sync.rsync_command(file_op) == [
|
||||
"rsync", "-abcEPuvW", "--backup-dir=backup", "src", "dst"
|
||||
"rsync",
|
||||
"-abcEPuvW",
|
||||
"--backup-dir=backup",
|
||||
"src",
|
||||
"dst",
|
||||
]
|
||||
|
||||
|
||||
@@ -95,18 +104,12 @@ def test_export_chowns_real_home_without_sudo(tmp_path, fake_runner, monkeypatch
|
||||
|
||||
sync.export_to_system()
|
||||
|
||||
chown_calls = [
|
||||
(cmd, sudo) for cmd, sudo in fake_runner.sudo_log if cmd[0] == "chown"
|
||||
]
|
||||
assert chown_calls == [
|
||||
(["chown", "-R", "kevin:kevin", str(real_home)], False)
|
||||
]
|
||||
chown_calls = [(cmd, sudo) for cmd, sudo in fake_runner.sudo_log if cmd[0] == "chown"]
|
||||
assert chown_calls == [(["chown", "-R", "kevin:kevin", str(real_home)], False)]
|
||||
assert (real_home / ".ssh/id_rsa").stat().st_mode & 0o777 == 0o600
|
||||
|
||||
|
||||
def test_execute_sync_plan_creates_folders_and_runs_rsync(
|
||||
tmp_path, fake_runner
|
||||
):
|
||||
def test_execute_sync_plan_creates_folders_and_runs_rsync(tmp_path, fake_runner):
|
||||
operation = sync.SyncOperation(
|
||||
source=str(tmp_path / "src.txt"),
|
||||
destination=str(tmp_path / "deep/nested/dst.txt"),
|
||||
|
||||
Reference in New Issue
Block a user