Skip to content

Fix mypy_test if mypy returns negative exit code #10866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Oct 11, 2023

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Oct 11, 2023

No description provided.

@srittau srittau requested a review from AlexWaygood October 11, 2023 10:07
@srittau srittau mentioned this pull request Oct 11, 2023
Turn `TestResults` into a dataclass that knows how to
combine multiple results.
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things I like here:

  • The existing behaviour of propagating the "maximum" returncode didn't make much sense; this PR fixes it
  • I love the new MypyResult enum

I'm not so sure about the changes to the TestResults class, though. Something that struck me as I was reviewing #10724 was that it's a bit weird that we use the same TestResults class to represent "the results of running mypy on one stubs package" and "the results of running mypy_test.py on the whole of typeshed". Those are conceptually different tasks, and it's already a bit of a leaky abstraction on main -- having a packages_skipped attribute on a TestResults instance representing the results of running mypy on one stubs package doesn't really make much sense. I think we should probably separate out the two concepts into two different "result" classes, but this PR feels like it's going in the opposite direction a little bit

@srittau
Copy link
Collaborator Author

srittau commented Oct 11, 2023

We could let test_stdlib() and test_third_party_distribution() just return mypy's return code and files tested, but all other functions are already aggregating results.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great! Just one more optional nit:

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

@AlexWaygood AlexWaygood merged commit 7e2a341 into python:main Oct 11, 2023
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