-
Notifications
You must be signed in to change notification settings - Fork 559
Commit ca02cb6
authored
test(streaming): add extensive tests for StreamingHandler to enhance coverage (#1183)
* fix(tests): ensure proper asyncio task cleanup in test_streaming_handler.py
- modified the `StreamingConsumer` class in to store its asyncio task
- added a `cancel()` method, and handle `asyncio.CancelledError`
- Updating test functions (`test_single_chunk`,
`test_sequence_of_chunks`) and the helper function
(`_test_pattern_case`) to call `consumer.cancel()` in a
`finally` block.
These changes prevent `RuntimeError: Event loop is closed` and
`Task was destroyed but it is pending!` warnings by ensuring
background tasks are correctly cancelled and awaited upon test
completion.
* test(streaming): add extensive tests for StreamingHandler to enhance
coverage
- Added tests for various functionalities of StreamingHandler, including:
- Piping streams between handlers
- Buffering enable/disable behavior
- Handling multiple stop tokens
- Metadata inclusion and processing
- Suffix and prefix pattern handling
- Edge cases for __anext__ method
- First token handling and generation info
- Improved test coverage for async methods and error scenarios.
- Addressed potential issues with streaming termination signals.1 parent fabd5f4 commit ca02cb6Copy full SHA for ca02cb6
File tree
Expand file treeCollapse file tree
1 file changed
+607
-7
lines changedOpen diff view settings
Filter options
- tests
Expand file treeCollapse file tree
1 file changed
+607
-7
lines changedOpen diff view settings
0 commit comments