Skip to content

[Bug]: fix the test cases that shut down event loop too early #412

@zhongkechen

Description

@zhongkechen

Expected Behavior

The futures need to be drained when the event loop is shut down in test cases

Actual Behavior

The tests are throwing the following warnings because the event loop is shut down too early.

Task was destroyed but it is pending!
task: <Task cancelling name='Task-356' coro=<Scheduler.call_later.<locals>.delayed_func() done, defined at /Users/frankchn/Library/Application Support/hatch/env/virtual/aws-durable-execution-sdk-python-monorepo/wf13lvoG/test/lib/python3.14/site-packages/aws_durable_execution_sdk_python_testing/scheduler.py:167> wait_for=<Future cancelled> cb=[_chain_future.<locals>._call_set_state() at /opt/homebrew/Cellar/python@3.14/3.14.5/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/futures.py:400]>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-338' coro=<Scheduler.call_later.<locals>.delayed_func() running at /Users/frankchn/Library/Application Support/hatch/env/virtual/aws-durable-execution-sdk-python-monorepo/wf13lvoG/test/lib/python3.14/site-packages/aws_durable_execution_sdk_python_testing/scheduler.py:170> wait_for=<Future cancelled> cb=[_chain_future.<locals>._call_set_state() at /opt/homebrew/Cellar/python@3.14/3.14.5/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/futures.py:400]>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-339' coro=<Scheduler.call_later.<locals>.delayed_func() running at /Users/frankchn/Library/Application Support/hatch/env/virtual/aws-durable-execution-sdk-python-monorepo/wf13lvoG/test/lib/python3.14/site-packages/aws_durable_execution_sdk_python_testing/scheduler.py:170> wait_for=<Future cancelled> cb=[_chain_future.<locals>._call_set_state() at /opt/homebrew/Cellar/python@3.14/3.14.5/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/futures.py:400]>

Steps to Reproduce

N/A

SDK Version

N/A

Python Version

3.14

Is this a regression?

No

Last Working Version

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions