From 611f247810ab76bedd6ed544068232982c071f06 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 16 Oct 2022 16:18:00 +0200 Subject: nixos/tests: Generalize nix-build file.nix hack to testing-python.nix --- nixos/lib/testing-python.nix | 10 ++++++++-- nixos/tests/make-test-python.nix | 4 +--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'nixos') diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index f63b6c78f6da3..d7204a2bc1434 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -29,7 +29,9 @@ rec { }; }; - # Make a full-blown test + # Make a full-blown test (legacy) + # For an official public interface to the tests, see + # https://nixos.org/manual/nixos/unstable/index.html#sec-calling-nixos-tests makeTest = { machine ? null , nodes ? {} @@ -48,7 +50,8 @@ rec { else builtins.unsafeGetAttrPos "testScript" t) , extraPythonPackages ? (_ : []) , interactive ? {} - } @ t: + } @ t: let + testConfig = (evalTest { imports = [ { _file = "makeTest parameters"; config = t; } @@ -60,6 +63,9 @@ rec { } ]; }).config; + in + testConfig.test # For nix-build + // testConfig; # For all-tests.nix simpleTest = as: (makeTest as).test; diff --git a/nixos/tests/make-test-python.nix b/nixos/tests/make-test-python.nix index c3bbd67423726..7a96f538d8d7a 100644 --- a/nixos/tests/make-test-python.nix +++ b/nixos/tests/make-test-python.nix @@ -6,6 +6,4 @@ f: { with import ../lib/testing-python.nix { inherit system pkgs; }; -let testConfig = makeTest (if pkgs.lib.isFunction f then f (args // { inherit pkgs; inherit (pkgs) lib; }) else f); -in testConfig.test # For nix-build - // testConfig # For all-tests.nix +makeTest (if pkgs.lib.isFunction f then f (args // { inherit pkgs; inherit (pkgs) lib; }) else f) -- cgit 1.4.1 From 1d9b9130883550f2f928c573b35fe8b8193d5c4b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 16 Oct 2022 16:19:29 +0200 Subject: nixos/lib/testing: Delay nodes.machine.~config~ migration Provide a window during which both solutions are valid without warnings, in order to fight warning fatigue, and not to push 3rd party repo maintainers to add unnecessary compat code. --- nixos/lib/testing/nodes.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nixos') diff --git a/nixos/lib/testing/nodes.nix b/nixos/lib/testing/nodes.nix index 0395238cbaae7..8e620c96b3bb1 100644 --- a/nixos/lib/testing/nodes.nix +++ b/nixos/lib/testing/nodes.nix @@ -101,7 +101,7 @@ in nodesCompat = mapAttrs (name: config: config // { - config = lib.warn + config = lib.warnIf (lib.isInOldestRelease 2211) "Module argument `nodes.${name}.config` is deprecated. Use `nodes.${name}` instead." config; }) -- cgit 1.4.1