Skip to content

tests: branch coverage in _utils.py, middleware/gzip.py, routing.py and requests.py#2816

Merged
Kludex merged 3 commits intoKludex:masterfrom
lealre:test-coverage-branch
Dec 28, 2024
Merged

tests: branch coverage in _utils.py, middleware/gzip.py, routing.py and requests.py#2816
Kludex merged 3 commits intoKludex:masterfrom
lealre:test-coverage-branch

Conversation

@lealre
Copy link
Contributor

@lealre lealre commented Dec 26, 2024

Summary

Related to Issue #2452

This PR covers all 9 missing cases.

starlette/_utils.py 78–82

Extend the # pragma: no cover to include the condition.

starlette/middleware/gzip.py 16–22, 91–end

Related to conditional cases with scope type and message type.
Added # pragma: no branch to all cases.

starlette/routing.py 199–202, 401–430, 484–496

Related to conditional cases where the scope type is not 'http' or 'websocket'.
Added # pragma: no branch to all cases.

starlette/requests.py 114–116, 233–225, 253–278

Although it's from requests.py, the test related to lines 114–116 was added in test_routing.py.
For the other two cases, # pragma: no branch was added.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@Kludex Kludex changed the title tests: branch coverage in _utils.py, middleware/gzip.py, routing.py and requests.py Set branch = true in coverage.run Dec 28, 2024
@Kludex Kludex enabled auto-merge (squash) December 28, 2024 04:45
@Kludex Kludex changed the title Set branch = true in coverage.run tests: branch coverage in _utils.py, middleware/gzip.py, routing.py and requests.py Dec 28, 2024
@Kludex Kludex disabled auto-merge December 28, 2024 04:49
@Kludex Kludex merged commit d6ace92 into Kludex:master Dec 28, 2024
6 checks passed
@lealre lealre deleted the test-coverage-branch branch December 28, 2024 11:12
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