nixpkgs/nixos/lib/test-driver/default.nix

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

80 lines
1.3 KiB
Nix
Raw Normal View History

2024-11-22 15:02:43 +00:00
{
lib,
python3Packages,
enableOCR ? false,
qemu_pkg ? qemu_test,
coreutils,
imagemagick_light,
netpbm,
qemu_test,
socat,
ruff,
tesseract4,
vde2,
extraPythonPackages ? (_: [ ]),
nixosTests,
}:
let
fs = lib.fileset;
in
python3Packages.buildPythonApplication {
pname = "nixos-test-driver";
2022-01-01 22:06:07 +00:00
version = "1.1";
2024-11-22 15:05:19 +00:00
pyproject = true;
src = fs.toSource {
root = ./.;
fileset = fs.unions [
./pyproject.toml
./test_driver
./extract-docstrings.py
];
};
2024-11-22 15:05:19 +00:00
build-system = with python3Packages; [
setuptools
];
dependencies =
with python3Packages;
[
colorama
junit-xml
ptpython
]
++ extraPythonPackages python3Packages;
2024-11-22 15:02:43 +00:00
propagatedBuildInputs =
[
coreutils
netpbm
qemu_pkg
socat
vde2
]
2024-11-22 15:05:19 +00:00
++ lib.optionals enableOCR [
2024-11-22 15:02:43 +00:00
imagemagick_light
tesseract4
2024-11-22 15:05:19 +00:00
];
passthru.tests = {
inherit (nixosTests.nixos-test-driver) driver-timeout;
};
doCheck = true;
2024-11-22 15:05:19 +00:00
2024-11-22 15:02:43 +00:00
nativeCheckInputs = with python3Packages; [
mypy
ruff
];
2024-11-22 15:05:19 +00:00
checkPhase = ''
echo -e "\x1b[32m## run mypy\x1b[0m"
mypy test_driver extract-docstrings.py
echo -e "\x1b[32m## run ruff check\x1b[0m"
ruff check .
echo -e "\x1b[32m## run ruff format\x1b[0m"
ruff format --check --diff .
'';
}