Context
The maverick flight-plan create command (added in #40) now handles PermissionError from both Path.mkdir() and Path.write_text() with a Rich-formatted error message and exit code 1. However, no unit test was written to verify this behaviour.
Missing coverage
tests/unit/cli/commands/flight_plan/test_create.py has no test for:
- Writing to a read-only output directory → expect exit code 1 + error message
- Writing to a path where the file itself is not writable → expect exit code 1 + error message
Suggested fix
Add parametrized tests that mock Path.mkdir and Path.write_text to raise PermissionError and assert:
- Exit code is 1
- The error output contains a user-friendly message (not a raw traceback)
from unittest.mock import patch
def test_create_permission_error_on_mkdir(cli_runner, tmp_path):
with patch("maverick.cli.commands.flight_plan.create.Path.mkdir", side_effect=PermissionError("denied")):
result = cli_runner.invoke(flight_plan, ["create", "my-plan", "--output-dir", str(tmp_path)])
assert result.exit_code == 1
assert "Permission denied" in result.output or "permission" in result.output.lower()
Origin
Flagged during code review of branch 040-flight-plan-cli (spec compliance review, severity MEDIUM).
Context
The
maverick flight-plan createcommand (added in #40) now handlesPermissionErrorfrom bothPath.mkdir()andPath.write_text()with a Rich-formatted error message and exit code 1. However, no unit test was written to verify this behaviour.Missing coverage
tests/unit/cli/commands/flight_plan/test_create.pyhas no test for:Suggested fix
Add parametrized tests that mock
Path.mkdirandPath.write_textto raisePermissionErrorand assert:Origin
Flagged during code review of branch
040-flight-plan-cli(spec compliance review, severity MEDIUM).