Skip to content

Replace command production assert with explicit exception - #106

Open
huda-code wants to merge 1 commit into
aboutcode-org:mainfrom
huda-code:fix-command-production-assert
Open

huda-code wants to merge 1 commit into
aboutcode-org:mainfrom
huda-code:fix-command-production-assert

Conversation

@huda-code

Copy link
Copy Markdown

Contributes to aboutcode-org/aboutcode#175

This PR replaces a production assert in commoncode/command.py with an explicit runtime exception.

Changes:

  • Replaced assert cmd_loc with FileNotFoundError
  • Kept pytest/test asserts unchanged

Why:
Production asserts can be skipped when Python is run with optimization flags (-O / -OO). Explicit exceptions ensure runtime validation is preserved consistently.

Tested with:
PYTHONPATH=src python3 -m pytest tests/test_command.py

Signed-off-by: HudaHajira <hudahajira744@gmail.com>

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

1 participant