Skip to content

Handle directory paths and path assertions gracefully on windows - #23

Merged
sergiobe-itx merged 1 commit into
InditexTech:mainfrom
jmcaamanog:fix/cli-windows-directory-handling
Oct 13, 2026
Merged

sergiobe-itx merged 1 commit into
InditexTech:mainfrom
jmcaamanog:fix/cli-windows-directory-handling

Conversation

@jmcaamanog

Copy link
Copy Markdown
Contributor

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
@sergiobe-itx sergiobe-itx added the skip-release Do not publish a release for this change. label Oct 13, 2026
@sergiobe-itx sergiobe-itx self-assigned this Oct 13, 2026
@sergiobe-itx sergiobe-itx changed the title fix(cli): handle directory paths and path assertions gracefully on windows Handle directory paths and path assertions gracefully on windows Oct 13, 2026
@sergiobe-itx
sergiobe-itx merged commit 36cb62c into InditexTech:main Oct 13, 2026
21 checks passed
@sergiobe-itx

Copy link
Copy Markdown
Contributor

Thanks for the contribution! 😄

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

Labels

skip-release Do not publish a release for this change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants