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-driver: add mypy support #73033

Merged
merged 1 commit into from Nov 12, 2019
Merged

test-driver: add mypy support #73033

merged 1 commit into from Nov 12, 2019

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Nov 8, 2019

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
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@Mic92
Copy link
Member Author

Mic92 commented Nov 8, 2019

Tested running borgbackup.nix

@Mic92
Copy link
Member Author

Mic92 commented Nov 8, 2019

cc @worldofpeace @flokli @marijanp

@marijanp
Copy link
Contributor

marijanp commented Nov 8, 2019

@tfc

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)
Copy link
Member

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

Copy link
Contributor

@marijanp marijanp left a 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.

@Mic92
Copy link
Member Author

Mic92 commented Nov 11, 2019

@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.
@Mic92
Copy link
Member Author

Mic92 commented Nov 12, 2019

@GrahamcOfBorg test borgbackup

@Mic92 Mic92 merged commit 550f508 into NixOS:master Nov 12, 2019
@Mic92 Mic92 deleted the mypy branch November 12, 2019 15:43
@domenkozar
Copy link
Member

🚀

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.

None yet

5 participants