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 , name ? "unnamed"
46 , skipTypeCheck ? false
47 # Skip linting (mainly intended for faster dev cycles)
48 , skipLint ? false
49 , passthru ? {}
50 , meta ? {}
51 , # For meta.position
52 pos ? # position used in error messages and for meta.position
53 (if meta.description or null != null
54 then builtins.unsafeGetAttrPos "description" meta
55 else builtins.unsafeGetAttrPos "testScript" t)
56 , extraPythonPackages ? (_ : [])
57 , interactive ? {}
58 } @ t: let
59 testConfig =
60 (evalTest {
61 imports = [
62 { _file = "makeTest parameters"; config = t; }
63 {
64 defaults = {
65 _file = "makeTest: extraConfigurations";
66 imports = extraConfigurations;
67 };
68 }
69 ];
70 }).config;
71 in
72 testConfig.test # For nix-build
73 // testConfig; # For all-tests.nix
74
75 simpleTest = as: (makeTest as).test;
76
77}