3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/lib/testing-python.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.8 KiB
Nix
Raw Normal View History

{ system
, pkgs ? import ../.. { inherit system config; }
# Use a minimal kernel?
, minimal ? false
# Ignored
, config ? { }
# !!! See comment about args in lib/modules.nix
, specialArgs ? { }
# Modules to add to each VM
, extraConfigurations ? [ ]
}:
let
nixos-lib = import ./default.nix { inherit (pkgs) lib; };
in
2020-05-14 13:34:50 +01:00
rec {
inherit pkgs;
evalTest = module: nixos-lib.evalTest { imports = [ extraTestModule module ]; };
runTest = module: nixos-lib.runTest { imports = [ extraTestModule module ]; };
extraTestModule = {
config = {
hostPkgs = pkgs;
};
};
# 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 ? {}
, testScript
, enableOCR ? false
, name ? "unnamed"
2022-06-03 12:37:04 +01:00
, skipTypeCheck ? false
# Skip linting (mainly intended for faster dev cycles)
, skipLint ? false
, passthru ? {}
, meta ? {}
2021-02-09 11:02:35 +00:00
, # For meta.position
pos ? # position used in error messages and for meta.position
(if meta.description or null != null
then builtins.unsafeGetAttrPos "description" meta
2021-02-09 11:02:35 +00:00
else builtins.unsafeGetAttrPos "testScript" t)
, extraPythonPackages ? (_ : [])
, interactive ? {}
} @ t: let
testConfig =
(evalTest {
imports = [
{ _file = "makeTest parameters"; config = t; }
{
defaults = {
_file = "makeTest: extraConfigurations";
imports = extraConfigurations;
};
}
];
}).config;
in
testConfig.test # For nix-build
// testConfig; # For all-tests.nix
simpleTest = as: (makeTest as).test;
}