-
Notifications
You must be signed in to change notification settings - Fork 319
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
Running mypy in tests/ #921
Conversation
@@ -468,7 +473,7 @@ class MkosiConfigDistro(MkosiConfigOne): | |||
- --distribution | |||
""" | |||
|
|||
def __init__(self, subdir_name=None, alldir_name=None): | |||
def __init__(self, subdir_name: str = "", alldir_name: str = "") -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alldir_name
is never used so maybe this can be removed.
for dist in Distribution: | ||
assert parse(["-d", dist.name]).distribution == dist | ||
|
||
with pytest.raises((argparse.ArgumentError, SystemExit)): | ||
with pytest.raises(tuple((argparse.ArgumentError, SystemExit))): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What error did you get here that mad you add the tuple
keyword?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't wanna waste too much time on those overengineered config parser tests in test_confg_parser and conftest so I don't mind a few Any's in there to make it pass type checking.
I have one comment on the use of the tuple keyword aside from that it looks fine
This is what I got without the tuple: error: Argument 1 to "raises" has incompatible type "Tuple[Type[ArgumentError], Type[SystemExit]]"; |
Apparently
tests/
was not being reviewed by Mypy. Added the folder to the respective line on the CI and tried to correct most of the stuff pointed by Mypy.Will leave a few comments because some of the errors are not necessarily crystal clear, a few things are still open issues so it seems.
Please feel free to leave suggestions on better approaches.