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

pytestCheckHook: add support for disabling arbitrary paths #113167

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

mweinelt
Copy link
Member

Renames disabledTestFiles to the more genereric disabledTestPaths to
reflect that change.

Motivation for this change

In the home-assistant package we disable tests on a whole directory, the disabledTestFiles option did not support this, due to a check for file existence. I've generalized this option to work for arbitrary paths and subsequently renamed the option.

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 nixpkgs-review --run "nixpkgs-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.

Renames `disabledTestFiles` to the more genereric `disabledTestPaths` to
reflect that change.
@jtojnar
Copy link
Member

jtojnar commented Feb 15, 2021

Note that the attribute will only work with a single list item according to #113153.

@mweinelt
Copy link
Member Author

mweinelt commented Feb 15, 2021

Pretty sure it does since #110700. That's in staging-next currently.

@mweinelt
Copy link
Member Author

Printing $args for

  disabledTestPaths = [
    # don't bulk test all components
    "tests/components"
    # pyotp since v2.4.0 complains about the short mock keys, hass pins v2.3.0
    "tests/auth/mfa_modules/test_notify.py"
  ];

looks like this:

-m pytest -k "[...]" --ignore="tests/components" --ignore="tests/auth/mfa_modules/test_notify.py" -n 2 --dist loadfile tests [...]

@mweinelt
Copy link
Member Author

mweinelt commented Feb 18, 2021

While #113220 is working to enable paths, that include whitespaces, this change allows to use multiple paths that can be either directory or file. I think we should merge this now, and rebase #113220 on top of it, so we don't get more disabledTestFiles in the meantime.

@SuperSandro2000 SuperSandro2000 merged commit 36ef53d into NixOS:staging Feb 18, 2021
@mweinelt mweinelt deleted the pytestcheckhook-paths branch February 18, 2021 16:14
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.

4 participants