Skip to content

Add pragma: no cover to unreachable return statement in test_http_exception_handler#358

Closed
Copilot wants to merge 2 commits intosupport-python-314from
copilot/update-test-coverage
Closed

Add pragma: no cover to unreachable return statement in test_http_exception_handler#358
Copilot wants to merge 2 commits intosupport-python-314from
copilot/update-test-coverage

Conversation

Copy link
Contributor

Copilot AI commented Dec 26, 2025

Line 170 in tests/test_http.py contained an unreachable return statement following an exception raise, causing 99% coverage instead of 100%.

Changes

  • Added # pragma: no cover comment to line 170 to exclude the intentionally unreachable code from coverage calculation
@app.route(path)
def homepage(request):
    raise Exception()
    return PlainTextResponse("Hello, world!")  # pragma: no cover

The return statement is deliberately unreachable—the test validates that exception handlers intercept raised exceptions before the return is reached.

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

tests/test_http.py 133 1 99% 170 coverage missing


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

…on_handler

Co-authored-by: Kludex <7353520+Kludex@users.noreply.github.com>
Copilot AI changed the title [WIP] Update test coverage in test_http.py Add pragma: no cover to unreachable return statement in test_http_exception_handler Dec 26, 2025
Copilot AI requested a review from Kludex December 26, 2025 21:25
@Kludex Kludex closed this Dec 26, 2025
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