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-driver: add mypy support #73033
Conversation
Tested running borgbackup.nix |
nixos/lib/test-driver/test-driver.py
Outdated
def wait_for_text(self, regex): | ||
def screen_matches(last): | ||
def wait_for_text(self, regex: str) -> None: | ||
def screen_matches(last: bool) -> bool: | ||
text = self.get_screen_text() | ||
m = re.search(regex, text) |
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.
maybe bring the correct type forward, so m = bool(re.search(regex, text))
instead of the return m is not 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.
@Mic92 I'm getting a Syntax Error in test-driver.py with your changes: SyntaxError: annotated name 'log' can't be global. (line 786)
Edit: It seems to be caused by the forward references. After commenting it out I don't get the syntax error anymore.
@marijanp fixed |
It's a good idea to expand this in future to test code as well, so we get type checking there as well.
@GrahamcOfBorg test borgbackup |
🚀 |
It's a good idea to expand this in future to test code as well,
so we get type checking there as well.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @