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.
I have a MR for stubtest out at python/mypy#18251. One of the things that got flagged was
unittest.runner.TextTestRunner.resultclass
and I was having a hard time figuring it out. I made a version ofunittest/runner.py
locally that had all of our existing stub annotations inline with the actual code, and ran mypy on that to try and figure it out. This is various fixes that were needed to make mypy satisfied with that version of the file._ResultClassType
to useTextTestResult[Any]
: This was the primary issue that got flagged in my MR for stubtest._WritelnDecorator
takes_SupportsWriteAndFlush
as the argument. It is_TextTestStream
, which addswriteln
on top of that, but it doesn't need to be passed something that already haswriteln
.writeln
doesn't actually return anythingdurations
is an integer which indexes intounittest.result._DurationsType
, notunittest.result._DurationsType
itself. It'sTestResult.collectedDurations
that is_DurationsType
.TextTestRunner.warnings
is passed towarnings.simplefilter
, which is typed for literals.