Fix asyncio warnings in test suite#227
Merged
thomwiggers merged 1 commit intodevelopfrom Feb 18, 2026
Merged
Conversation
|
🤖 Hi @thomwiggers, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 I'm sorry @thomwiggers, but I was unable to process your request. Please see the logs for more details. |
a52d6d2 to
225a956
Compare
Bypass irc3.testing.IrcBot which leaks temporary event loops (creates asyncio.new_event_loop() just for autospec, then discards without closing). Our IrcBot now inherits from irc3.IrcBot directly, closing the temp loop. Add addCleanup-based loop teardown in BotTestCase.callFTU() that cancels pending tasks and closes real event loops after each test. Set asynchronous=False by default for test bots to avoid unnecessary process_queue coroutines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
225a956 to
9515202
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
irc3.testing.IrcBotandirc3.testing.BotTestCasewith our own versions that properly manage asyncio event loops, fixing all 9 asyncio-related test warnings.Changes to
onebot/testing.pyIrcBot(now inherits fromirc3.IrcBotdirectly instead ofirc3.testing.IrcBot):create_autospec(irc3 leaks it)check_required()is a no-op (avoids creating~/.irc3/during tests)asynchronous=Falsewhen a real loop is provided, preventing irc3 from spawning aprocess_queuecoroutine that is never cleaned uppatchfromunittest.mock(used by plugin doctests)BotTestCase:IrcBotinstead ofirc3.testing.IrcBotaddCleanuphandler that cancels pending asyncio tasks and closes real event loops after each testChanges to tests
test_onebot.py: Passasynchronous=FalsetoOneBotand close the event loop in tearDowntest_plugin_acl.py: Remove redundant manualloop.close()(now handled by base class)Test plan
🤖 Generated with Claude Code