Merge pull request #193485 from hercules-ci/nixos-lib-runTest-return-test

nixos/testing: Fix release.nix tests evaluation
This commit is contained in:
K900 2022-09-29 12:54:30 +03:00 committed by GitHub
commit f54f12a602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 12 deletions

View file

@ -49,7 +49,7 @@ rec {
, extraPythonPackages ? (_ : [])
, interactive ? {}
} @ t:
runTest {
(evalTest {
imports = [
{ _file = "makeTest parameters"; config = t; }
{
@ -59,7 +59,7 @@ rec {
};
}
];
};
}).config;
simpleTest = as: (makeTest as).test;

View file

@ -4,13 +4,9 @@ let
in
{
options = {
callTest = mkOption {
internal = true;
type = types.functionTo types.raw;
};
result = mkOption {
internal = true;
default = config.test;
default = config;
};
};
}

View file

@ -2,7 +2,7 @@
let
evalTest = module: lib.evalModules { modules = testModules ++ [ module ]; };
runTest = module: (evalTest module).config.result;
runTest = module: (evalTest ({ config, ... }: { imports = [ module ]; result = config.test; })).config.result;
testModules = [
./call-test.nix

View file

@ -45,9 +45,9 @@ let
inherit
(rec {
doRunTest = arg: (import ../lib/testing-python.nix { inherit system pkgs; }).runTest {
imports = [ arg { inherit callTest; } ];
};
doRunTest = arg: ((import ../lib/testing-python.nix { inherit system pkgs; }).evalTest {
imports = [ arg ];
}).config.result;
findTests = tree:
if tree?recurseForDerivations && tree.recurseForDerivations
then

View file

@ -67,6 +67,6 @@
else test;
calledTest = lib.toFunction loadedTest pkgs;
in
nixosTesting.makeTest calledTest;
nixosTesting.simpleTest calledTest;
}