Commit 3f5ad03
test: fix dead assert in retry streaming tests causing coverage issues (#17723)
## Problem
In `test_retry_streaming.py` and `test_retry_streaming_async.py`, an
assert statement was indented inside the `pytest.raises` context manager
block. In Python testing with `pytest`, any code in a pytest.raises
block that follows line that raises the expected exception is NOT
executed.
This meant that the assert statement intended to verify the exception
message was dead code and never ran.
## Solution
The assert statement has been dedented (moved outside and after the
`pytest.raises` block) to ensure it executes after the exception is
caught. This allows the test to actually verify the exception message as
originally intended.
## Notes to Reviewers
This fix ensures that the tests are actually checking that the exception
contains the message "can't send non-None value". It also helps with
code coverage metrics by removing dead code.1 parent bfb1168 commit 3f5ad03
2 files changed
Lines changed: 2 additions & 2 deletions
File tree
- packages/google-api-core/tests
- asyncio/retry
- unit/retry
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
0 commit comments