at 24.11-pre 2.3 kB view raw
1args@ 2{ system 3, pkgs ? import ../.. { inherit system config; } 4 # Use a minimal kernel? 5, minimal ? false 6 # Ignored 7, config ? { } 8 # !!! See comment about args in lib/modules.nix 9, specialArgs ? throw "legacy - do not use, see error below" 10 # Modules to add to each VM 11, extraConfigurations ? [ ] 12}: 13let 14 nixos-lib = import ./default.nix { inherit (pkgs) lib; }; 15in 16 17pkgs.lib.throwIf (args?specialArgs) '' 18 testing-python.nix: `specialArgs` is not supported anymore. If you're looking 19 for the public interface to the NixOS test framework, use `runTest`, and 20 `node.specialArgs`. 21 See https://nixos.org/manual/nixos/unstable/index.html#sec-calling-nixos-tests 22 and https://nixos.org/manual/nixos/unstable/index.html#test-opt-node.specialArgs 23'' 24rec { 25 26 inherit pkgs; 27 28 evalTest = module: nixos-lib.evalTest { imports = [ extraTestModule module ]; }; 29 runTest = module: nixos-lib.runTest { imports = [ extraTestModule module ]; }; 30 31 extraTestModule = { 32 config = { 33 hostPkgs = pkgs; 34 }; 35 }; 36 37 # Make a full-blown test (legacy) 38 # For an official public interface to the tests, see 39 # https://nixos.org/manual/nixos/unstable/index.html#sec-calling-nixos-tests 40 makeTest = 41 { machine ? null 42 , nodes ? {} 43 , testScript 44 , enableOCR ? false 45 , globalTimeout ? (60 * 60) 46 , name ? "unnamed" 47 , skipTypeCheck ? false 48 # Skip linting (mainly intended for faster dev cycles) 49 , skipLint ? false 50 , passthru ? {} 51 , meta ? {} 52 , # For meta.position 53 pos ? # position used in error messages and for meta.position 54 (if meta.description or null != null 55 then builtins.unsafeGetAttrPos "description" meta 56 else builtins.unsafeGetAttrPos "testScript" t) 57 , extraPythonPackages ? (_ : []) 58 , interactive ? {} 59 } @ t: let 60 testConfig = 61 (evalTest { 62 imports = [ 63 { _file = "makeTest parameters"; config = t; } 64 { 65 defaults = { 66 _file = "makeTest: extraConfigurations"; 67 imports = extraConfigurations; 68 }; 69 } 70 ]; 71 }).config; 72 in 73 testConfig.test # For nix-build 74 // testConfig; # For all-tests.nix 75 76 simpleTest = as: (makeTest as).test; 77 78}