Skip to content
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

test: add type hints to test_log tests #1009

Merged
merged 8 commits into from
Sep 22, 2023

Conversation

tonyandrewmeyer
Copy link
Contributor

@tonyandrewmeyer tonyandrewmeyer commented Sep 22, 2023

Minor type hinting to make pyright happy:

$ env PYTHONPATH=.tox/static/lib/python3.10/site-packages/ .tox/static/bin/pyright test/test_log.py 
WARNING: there is a new pyright version available (v1.1.317 -> v1.1.327).
Please install the new version or set PYRIGHT_PYTHON_FORCE_VERSION to `latest`

0 errors, 0 warnings, 0 informations 

Most significant change is that the fake model backend now inherits from the real one.

Partially addresses #1007.

For the model backend stub, we know that the type won't match, but we don't really care. We could make an abc that both the stub and the real class could inherit from, or we could subclass for the stub, but those seem overkill for this specific use case. It seems unlikely that type hints would show any real-life issues here.
test/test_log.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@tonyandrewmeyer
Copy link
Contributor Author

@benhoyt do you want a second reviewer for this, or are type hint fixes too minimal? If you do, could you suggest someone?

Copy link
Collaborator

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

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

Looks good. Nah, just me for review is fine on these low-impact typing fixes.

@tonyandrewmeyer
Copy link
Contributor Author

@benhoyt Resolved the pyproject conflict.

@benhoyt benhoyt merged commit fa60525 into canonical:main Sep 22, 2023
17 checks passed
@tonyandrewmeyer tonyandrewmeyer deleted the pyright-test_log-1007 branch September 22, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants