-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add driver unit tests #3
Conversation
c3e26fe
to
2290c67
Compare
9ca6331
to
8b72551
Compare
test/test_drivers.py
Outdated
def __call__( | ||
self, | ||
mock_obj: Any, # the k8s model objects have no common superclass | ||
state: str | None = None, | ||
state_contains: str | None = None, | ||
) -> 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.
Why have this be a __call__
function rather than like assert_consistent_state()
or something like that?
I tried to eliminate as much code duplication as possible without being excessively magical. There's still a healthy amount of duplication, but I'm not sure there's much to be done about it at this point without getting deep into metaprogramming.
5fd799f
to
b81ed63
Compare
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.
Beautiful
# (https://github.com/kubernetes-client/python/issues/225), and I | ||
# couldn't get any of the third-party stub packages (e.g., | ||
# https://pypi.org/project/kubernetes-stubs-elephant-fork/) to work. | ||
ignore = ["kwait/drivers.py", "test/test_drivers.py"] |
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.
Annoying :(
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.
You might consider this solution: microsoft/pyright#945
So that we can ignore the imports from that module without ignoring typing in those files altogether
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'm going to merge this as-is and try to work on the typing stuff in a different PR to make it clearer what's happening. This looks promising though....
No description provided.