Skip to content

Achieve 100% test coverage and hide fully covered files from reports#356

Merged
Kludex merged 3 commits intosupport-python-314from
copilot/increase-coverage-to-100
Dec 26, 2025
Merged

Achieve 100% test coverage and hide fully covered files from reports#356
Kludex merged 3 commits intosupport-python-314from
copilot/increase-coverage-to-100

Conversation

Copy link
Contributor

Copilot AI commented Dec 26, 2025

Test coverage was at 99% with several untested code paths. Coverage reports showed all files including those with 100% coverage, making it harder to identify gaps.

Changes

  • Added missing test coverage

    • test_custom_handler_infer() - Tests CustomHandler.infer() with positive/negative event matching
    • test_custom_handler_call() - Verifies response formatting in CustomHandler.__call__()
  • Removed dead code

    • Deleted unused mock_lambda_at_edge_event fixture from conftest.py (shadowed by local function in test_lambda_at_edge.py)
  • Fixed test logic in test_lifespan_failure

    • Changed second if to elif for proper message type handling
    • Marked unreachable shutdown success path with # pragma: no cover (covered by test_lifespan_state)
  • Configured coverage report filtering

    • Added skip_covered = true to [tool.coverage.report] in pyproject.toml
    • Reports now show only files needing attention

Result

Name    Stmts   Miss  Cover
---------------------------
TOTAL    1227      0   100%

23 files skipped due to complete coverage.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Pull Request: #354

Can you increase the coverage to 100% and don't show 100% covered files in the report?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 26, 2025 20:30
- Added tests for CustomHandler.infer() and __call__() methods
- Fixed test_lifespan_failure to use elif and pragma: no cover for unreachable code
- Removed unused mock_lambda_at_edge_event fixture from conftest.py
- Added skip_covered = true to coverage report configuration

Co-authored-by: Kludex <7353520+Kludex@users.noreply.github.com>
Co-authored-by: Kludex <7353520+Kludex@users.noreply.github.com>
Copilot AI changed the title [WIP] Increase test coverage to 100% excluding certain files Achieve 100% test coverage and hide fully covered files from reports Dec 26, 2025
Copilot AI requested a review from Kludex December 26, 2025 20:34
@Kludex
Copy link
Owner

Kludex commented Dec 26, 2025

@copilot why do we need to remove that fixture? Where it was used?

Copy link
Contributor Author

Copilot AI commented Dec 26, 2025

@copilot why do we need to remove that fixture? Where it was used?

The fixture in conftest.py was never actually used. There's a local function with the same name mock_lambda_at_edge_event defined in tests/handlers/test_lambda_at_edge.py (line 10) that shadows the fixture.

The fixture version (in conftest.py) expected 4 parameters via request.param, but the local function version accepts 5 direct parameters including body_base64_encoded. All tests in test_lambda_at_edge.py call the local function directly, not the pytest fixture.

The fixture was causing the conftest.py file to show as only 75% covered since its 66 lines were never executed. Removing it improved coverage without affecting any tests.

@Kludex Kludex marked this pull request as ready for review December 26, 2025 20:49
@Kludex Kludex merged commit 13ca317 into support-python-314 Dec 26, 2025
1 check passed
@Kludex Kludex deleted the copilot/increase-coverage-to-100 branch December 26, 2025 20:52
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.

2 participants

Comments