-
-
Notifications
You must be signed in to change notification settings - Fork 102
Add missing test coverage for exception handling in scanapi/scan.py #881
Copy link
Copy link
Open
Labels
Code QualityImpacts the code quality: tests, logs, alerts...Impacts the code quality: tests, logs, alerts...Good First IssueGood for newcomers or first time contributors.Good for newcomers or first time contributors.PyCon DE 2026Issues marked with this label are specifically intended for participants of the PyCon DE tutorial.Issues marked with this label are specifically intended for participants of the PyCon DE tutorial.
Metadata
Metadata
Assignees
Labels
Code QualityImpacts the code quality: tests, logs, alerts...Impacts the code quality: tests, logs, alerts...Good First IssueGood for newcomers or first time contributors.Good for newcomers or first time contributors.PyCon DE 2026Issues marked with this label are specifically intended for participants of the PyCon DE tutorial.Issues marked with this label are specifically intended for participants of the PyCon DE tutorial.
This issue is currently reserved for participants of a tutorial at PyCon DE & PyData 2026. It is part of a guided session, so contributions may be coordinated during the event. If the issue is not resolved during the tutorial, it will be reopened for general contributions afterward. Thank you for your understanding and interest in contributing 💜
Description
There is currently missing test coverage for the exception handling block in
scanapi/scan.py, specifically:According to Codecov, this part of the code is not being exercised by the test suite:
https://app.codecov.io/gh/scanapi/scanapi/blob/main/scanapi%2Fscan.py
Goal
Add tests that ensure this exception handling path is properly covered.
What needs to be done
Add tests in
tests/unit/test_scan.pyCreate scenarios that simulate:
BadConfigurationErrorInvalidPythonCodeErrorVerify that:
SystemExitExitCode.USAGE_ERRORSuggested approach
pytest.raises(SystemExit)to assert the exit behaviorcaplogto assert logging behaviorAcceptance criteria
scanapi/scan.pyAdditional context
tests/unit/test_scan.pywiki/Writing-Tests.mdThis is a great issue for contributors who want to get familiar with:
pytest