Skip to content

Conversation

@jelmer
Copy link
Member

@jelmer jelmer commented Jan 24, 2026

No description provided.

@jelmer jelmer enabled auto-merge January 24, 2026 13:09
@jelmer jelmer force-pushed the fix-typing branch 2 times, most recently from 3d76abf to 1815666 Compare January 24, 2026 13:20
Remove testtools.assertions, testtools.compat, testtools.run,
testtools.matchers.*, testtools.monkey, and testtools.runtest
from mypy strict override list as they now have full type annotations.
Explicitly capture the return value from addBoth() when adding
validation callbacks to Deferred objects. While addBoth() modifies
the Deferred in place and returns it, explicitly using the return
value ensures the properly chained Deferred is returned from
_run_setup and _run_teardown.

This fixes a test failure specific to Python 3.12 where the validation
callback chain wasn't being properly handled.
The typing changes in commit 282db18 inadvertently broke the async
setUp/tearDown validation by:
1. Renaming the return value variable from `ret` to `setup_result`/`teardown_result`
2. Adding an unnecessary `is not None` check before the duck-typing check

These changes, while logically equivalent, caused test failures on Python 3.12.
Reverting to the original variable names and removing the None check
fixes the issue while maintaining type safety with appropriate type: ignore
comments.

Fixes the test failure in:
tests.twistedsupport.test_runtest.TestAsyncSetUpTearDownValidation.test_async_setup_with_deferred_upcall
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