pytestCheckHook: support inclusion and exclusion of path globs, test items, keywords, and markers#386513
Conversation
4501097 to
c5c9dab
Compare
d9e5f0f to
80b35f2
Compare
…bledTestPaths flags
…edTestPaths Pass disabledTestPaths elements containing double colons (::) to --deselect instead of --ignore-glob.
80b35f2 to
a238b9d
Compare
|
Do you think we should rename from This way, we can call the whole set of arguments:
Ping @wolfgangwalther |
a238b9d to
8c64725
Compare
8c64725 to
8c0090b
Compare
|
I improved the example based on pytest's default test discovery documented in its reference manual. See the discussion comment for detail: #386513 (comment) |
pkgs/development/interpreters/python/hooks/pytest-check-hook.sh
Outdated
Show resolved
Hide resolved
MattSturgeon
left a comment
There was a problem hiding this comment.
A few minor suggestions, nothing blocking
75b99b9 to
9417ba1
Compare
|
@MattSturgeon, I addressed the suggestions and adopted the definition-list syntax. I also add |
9417ba1 to
05a9d04
Compare
…ssions
Wrap each elements of disabledTests with parenthesis
so that when __structuredAttrs = true,
people could use sub-expressions an element.
E.g.
```nix
{
disabledTests = [
"ClassFoo and test_foo"
"test_bar"
];
}
05a9d04 to
8ba0944
Compare
wolfgangwalther
left a comment
There was a problem hiding this comment.
Did not do any builds or tests, but code LGTM.
(short of the current CI failure for nixfmt)
Co-authored-by: Sandro <[email protected]> Co-authored-by: Matt Sturgeon <[email protected]> Co-authored-by: Wolfgang Walther <[email protected]>
8ba0944 to
bb76d74
Compare
|
BTW, the current |
Let's see if @ofborg build nixpkgs-manual |
Addressed. |
|
The OfBorg CI test building xyzservices on aarch64-linux fails because an inline test of The tests should be lighter: |
|
I cherry-picked the documentation changes onto nixos-unstable-small and the Nixpkgs Manual builds fine. OfBorg's failures to build Partial log: That is unrelated to this issue. Given that |
| else | ||
| # The `|| kill "$$"` trick propagates the errors from the process substitutiton subshell, | ||
| # which is suggested by a StackOverflow answer: https://unix.stackexchange.com/a/217643 | ||
| readarray -t -O"${#flagsArray[@]}" flagsArray < <(@pythonCheckInterpreter@ - "$path" <<EOF || kill "$$") |
There was a problem hiding this comment.
I'm afraid this doesn't work as expected,
In a random hydra log, I found this error:
/nix/store/l3797z8ybpgk14ara7z0ld4hsnrpnvyv-pytest-check-hook/nix-support/setup-hook: line 41: warning: command substitution: 1 unterminated here-document
This makes sense - the here doc starts in the subshell, but ends outside.
What I am confused about even more is the fact that this doesn't break the build at this stage, yet.
There was a problem hiding this comment.
I'm afraid this doesn't work as expected,
In a random hydra log, I found this error:
/nix/store/l3797z8ybpgk14ara7z0ld4hsnrpnvyv-pytest-check-hook/nix-support/setup-hook: line 41: warning: command substitution: 1 unterminated here-documentThis makes sense - the here doc starts in the subshell, but ends outside.
I'll fix it this weekend.
What I am confused about even more is the fact that this doesn't break the build at this stage, yet.
I guess it's because the syntax error require a missing EOF for the heredoc, which is only valid when taking account the whole line. Since it the doesn't happen before the || operator, it isn't caught by the kill command.
There was a problem hiding this comment.
I guess it's because the syntax error require a missing EOF for the heredoc, which is only valid when taking account the whole line. Since it the doesn't happen before the
||operator, it isn't caught by the kill command.
Ah, ok! So it's a demonstration of why we need the kill:) (for other, non-syntax errors, that is)
There was a problem hiding this comment.
@wolfgangwalther Here is the fix: #403973.
|
I proposed in #425191 to add a default value |
If applied, pytestCheckHook will accept
enabledTestPathsanddisabledTestPathsto include/exclude either path globs or test items (<file path>::<specifier>)enabledTestsanddisabledTeststo include/exclude keywordsenabledTestMarksanddisabledTestMarksto include/exclude markersThe inclusion corresponds to the positional arguments of
pytest, as described by the PyTest documentation.The path globs inside
enabledTestPathsis expanded using an in-line Python script powered by theglobmodule from the Python Standard Library.enabledTestPathsis crucial for deprecatingpytestFlagsArray, or we'll have to specify globbed paths insidepreCheck. Other attributes also enhance the structural selection of the test cases.This enhancement is essential to the tree-wide transition to deprecate the non
__structuredAttrs-compatiblepytestFlagsArrayflags. See the previous discussion: #347194 (comment)The keyword and markers expressions shares the same form
((inc1) or (inc2)) and not (exc1) and not (exc2), and are passed to-kand-mrespectively.I have considered renaming them to
includeTestsandexcludeTests, but I'm unsure if tree-wide renaming fromdisabledTeststoexcludeTestswould be worthwhile.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.