Fix mypy errors in simple_backup() and Backup
Accept None for the missing inputs, output, exclude and keep values and replace them with their defaults in __init__, and annotate the SSH client, which mypy typed as None and so skipped checking the remote code.
This commit is contained in:
+2
-2
@@ -79,14 +79,14 @@ class TestCheckParams:
|
||||
assert sb.Backup([], str(out), [], -1, OPTIONS).check_params() == 1
|
||||
|
||||
def test_no_output(self) -> None:
|
||||
assert sb.Backup(['/x'], None, [], -1, OPTIONS).check_params() == 2 # type: ignore[arg-type]
|
||||
assert sb.Backup(['/x'], None, [], -1, OPTIONS).check_params() == 2
|
||||
|
||||
def test_missing_output(self, tmp_path: Path) -> None:
|
||||
assert sb.Backup(['/x'], str(tmp_path / 'missing'), [], -1, OPTIONS).check_params() == 2
|
||||
|
||||
def test_relative_output(self, out: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.chdir(out.parent)
|
||||
backup = sb.Backup(['/x'], out.name, [], None, OPTIONS) # type: ignore[arg-type]
|
||||
backup = sb.Backup(['/x'], out.name, [], None, OPTIONS)
|
||||
|
||||
assert backup.check_params() == 0
|
||||
assert backup.output == str(out)
|
||||
|
||||
Reference in New Issue
Block a user