Skip to content

fix(cli): handle directory paths and path assertions gracefully on windows - #23

Open
jmcaamanog wants to merge 1 commit into
InditexTech:mainfrom
jmcaamanog:fix/cli-windows-directory-handling
Open

jmcaamanog wants to merge 1 commit into
InditexTech:mainfrom
jmcaamanog:fix/cli-windows-directory-handling

Conversation

@jmcaamanog

Copy link
Copy Markdown

Summary of Changes

  • CLI Config Loading: On Windows systems, calling open() on a directory path raises a PermissionError (Errno 13, EACCES) instead of POSIX's IsADirectoryError (Errno 21, EISDIR). Updated load_config_from_yaml in packages/cerbia-cli/src/cerbia/cli/config.py to check if path.is_dir() when catching PermissionError, ensuring consistent and actionable error reporting across all operating systems.
  • CLI Tests:
    • Stripped table box-drawing characters (│) when normalizing scan --help output in packages/cerbia-cli/tests/unit/cerbia/cli/scan/test_command.py to prevent brittle assertions caused by terminal column line wrapping.
    • Parsed scan result payloads with json.loads in test_scan_uses_real_cli_text_and_file_loaders to handle escaped backslashes in Windows file paths reliably.

Validation

  • All 71 CLI unit tests passing on Windows (pytest packages/cerbia-cli/tests/unit).
  • Full codebase linted and formatted with Ruff (ruff check & ruff format).

@jmcaamanog
jmcaamanog requested a review from a team as a code owner October 9, 2026 07:20
@signoff-validator

signoff-validator Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Contribution License Agreement - Valid 🟢

All commits contain valid signoff. As a confirmation, remember that you are agreeing to our Contribution License Agreement.

@jmcaamanog
jmcaamanog force-pushed the fix/cli-windows-directory-handling branch 2 times, most recently from 8018dd5 to af8aee4 Compare October 9, 2026 07:46
…ndows

- Catch PermissionError on Windows when opening directories in load_config_from_yaml and report as directory path error

- Strip table box-drawing characters when normalizing scan help output in tests to prevent line-wrapping assertion failures

- Use json.loads to parse scan results in CLI tests to handle escaped Windows path separators properly

Signed-off-by: jmcaamanog <jose.caamano@live.com>
@jmcaamanog
jmcaamanog force-pushed the fix/cli-windows-directory-handling branch from af8aee4 to 561bd77 Compare October 9, 2026 07:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant