python3Packages.buildPythonPackage: default enabledTestPaths = [ "." ]
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.
This commit is contained in:
@@ -1285,6 +1285,7 @@ Adding `pytest` is not required, since it is included with `pytestCheckHook`.
|
||||
`enabledTestPaths` and `disabledTestPaths`
|
||||
|
||||
: To specify path globs (files or directories) or test items.
|
||||
`enabledTestPaths` defaults to `[ "." ]`.
|
||||
|
||||
`enabledTests` and `disabledTests`
|
||||
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
- The minimum version of Nix required to evaluate Nixpkgs has been raised from 2.3 to 2.18.
|
||||
|
||||
- `buildPythonPackage` and `buildPythonApplication` now set `enabledTestPaths = [ "." ]` by default if not specified otherwise, and require the specified value to be a non-empty list to simplify overriding.
|
||||
|
||||
When running install-checks with `pytestCheckHook`, such default value resembles `pytest`'s default behaviour of discovering tests in the current working directory.
|
||||
|
||||
To support both version of Nixpkgs before and after this change, set `enabledTestPaths = [ "." ]` manually for packages that don't need custom `enabledTestPaths` specification.
|
||||
|
||||
- The `offrss` package was removed due to lack of upstream maintenance since 2012. It's recommended for users to migrate to another RSS reader
|
||||
|
||||
- `base16-builder` node package has been removed due to lack of upstream maintenance.
|
||||
|
||||
@@ -431,6 +431,17 @@ let
|
||||
# Longer-term we should get rid of `checkPhase` and use `installCheckPhase`.
|
||||
installCheckPhase = attrs.checkPhase;
|
||||
}
|
||||
// {
|
||||
# `pytest` defaults to discover tests in the current directory if no paths or test items are specified.
|
||||
# Provide an explicit default value to simplify overriding.
|
||||
enabledTestPaths =
|
||||
if attrs ? enabledTestPaths then
|
||||
lib.throwIf (!lib.isList attrs.enabledTestPaths || attrs.enabledTestPaths == [ ])
|
||||
"${lib.getName finalAttrs}: enabledTestPaths must be a non-empty list (default to [ \".\" ])."
|
||||
attrs.enabledTestPaths
|
||||
else
|
||||
[ "." ];
|
||||
}
|
||||
//
|
||||
lib.mapAttrs
|
||||
(
|
||||
@@ -442,7 +453,6 @@ let
|
||||
(
|
||||
getOptionalAttrs [
|
||||
"enabledTestMarks"
|
||||
"enabledTestPaths"
|
||||
"enabledTests"
|
||||
] attrs
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user