python3Packages.buildPythonPackage: default enabledTestPaths = [ "." ]#425191
Conversation
|
Just to be clear the "complication" in overriding is If that's the case.. this is such a common overriding pattern, I really don't think we need to fix this here. So I'm 👎 on this change. But maybe I'm missing something. |
It would be
without this change. |
|
Ah, I see the problem now. I went through the discussions in #386513 twice, but I couldn't find anything discussing the choice of allowing Why do we allow |
|
But I see that even if we solve the Which might not be too bad, but I'm not sure about the practicability. It's certainly unintuitive. |
wolfgangwalther
left a comment
There was a problem hiding this comment.
The change as is makes sense.
I'd say we could still consider disallowing null from being allowed, but not sure. Might not be needed, but we should at least remove it from the list of "OK values" in the error message.
Argh!
|
To me, personally, I actually find it more intuitive that I usually conceptualise That said, I can see how the attr being missing having a default behaviour (being equivalent to One issue with this proposal is it makes it impossible for the override to explicitly not include Would it make sense to have a separate attr like That way |
I thought about this, too, but consider:
|
I was wrong to say "impossible"... Somehow I momentarily forgot that the prev value must be explicitly included in the new value, using So if one wanted part of the old value, they could use standard list manipulation tools like The only confusing thing they'd need to know is that |
|
This should be |
|
Is |
No. That's only available when using the module system. |
3a56748 to
75e3953
Compare
Addressed.
I also think we should enforce this, but not sure about how to implement for a smooth transition experience. Should we backport the backward-compatible part of this change, and enforce the new rule in a separate commit? |
75e3953 to
4f646ec
Compare
Is there a backwards-compatible part of this change at all? Not having a default causes a certain behavior when overriding, and this behavior is changed now. Personally, I'd be more concerned about that default-value-change than a change about disallowing null. Thus, I think we can either backport both or none of these. I don't think we necessarily need to split them into separate commits. |
4f646ec to
e3372dc
Compare
I see. The non-empty-list assertion is now enforced. I adjusted the release note to reflect the changes. Please take a look! |
e3372dc to
a9ad573
Compare
wolfgangwalther
left a comment
There was a problem hiding this comment.
LGTM reading through, but didn't run any code.
Explicitly provide a default value for the argument `enabledTestPaths` as the current working directory (`enabledTestPaths = [ "." ]`) to simplify overriding (making `enabledTestPaths` always specified as a non-empty list) while preserving `pytest`'s default behaviour of discovering tests in the current working directory. Assert the specified `enabledTestPaths` value to be a non-empty list.
a9ad573 to
5bf25df
Compare
|
Both |
It seems like this default behavior is not as simple as assumed, see #434974 (comment). I assume this affects potentially a lot of packages, so I think we should revert this? |
Same vibe. Let's revert. |
Description
Summary
This is a proposal to explicitly provide a default value for the argument
enabledTestPathsas the current working directory (enabledTestPaths = [ "." ]) to simplify overriding (makingenabledTestPathsalways specified as a non-empty list) while preservingpytest's default behaviour of discovering tests in the current working directory.Background
pytestCheckHook's current test-selection interface consists of the following attributes:enabledTestPathsanddisabledTestPathsenabledTestMarksanddisabledTestMarksenabledTestsanddisabledTestsWhere
enabledTestsand the current implementation of(enabled|disabled)(TestMarks|Tests)is provided in PR #386513To avoid semantic confusion, the
enabled-attributes are not allow to take an empty list ([ ]). They can either be unspecified,null, or a non-empty list. This results in a rather complex overriding interface -- The overriding function need to handle the edge case where the previous state of the attribute might be unspecified ornullbefore starting list operation, and set it to null and optionallydoCheckto false when the processed list might otherwise be empty.After the proposed change,
enabledTestPathsshould always be specified as a non-empty list, which greatly simplifies the overriding.Drawbacks
buildPythonPackage) namespace pollutionpytestCheckHookglobally even when the setup hook is not used seems unclean and could be confusing.pytestis the de facto standard for writing Python tests, which somehow justifies its space in thebuildPythonPackage-level.enabled(Tests|TestMarks)attributesenabledTestPathswill differ from that ofenabledTestMarksandenabledTests.enabledTestPathsand the other twoenabled-attributes are quite different, and the former occurs much more often than the latter.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.