2021-03-22 15:19:47 +03:00
|
|
|
pkgs:
|
2020-01-12 22:52:40 +03:00
|
|
|
let
|
2021-03-22 15:19:47 +03:00
|
|
|
pythonTesting = import "${toString pkgs.path}/nixos/lib/testing-python.nix" {
|
2021-03-22 15:19:48 +03:00
|
|
|
system = pkgs.stdenv.hostPlatform.system;
|
2021-03-22 15:19:47 +03:00
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
in
|
2020-01-12 22:52:40 +03:00
|
|
|
|
2021-03-22 15:19:47 +03:00
|
|
|
args:
|
|
|
|
let
|
|
|
|
test = pythonTesting.makeTest args;
|
2020-01-12 22:52:40 +03:00
|
|
|
|
2021-08-05 01:49:08 +03:00
|
|
|
# 1. Save test logging output
|
|
|
|
# 2. Add link to driver so that a gcroot to a test prevents the driver from
|
2021-03-22 15:19:47 +03:00
|
|
|
# being garbage-collected
|
|
|
|
fixedTest = test.overrideAttrs (_: {
|
|
|
|
# See `runTests` in nixpkgs/nixos/lib/testing-python.nix for the original definition of `buildCommand`
|
|
|
|
buildCommand = ''
|
2022-08-16 22:00:00 +03:00
|
|
|
mkdir "$out"
|
2021-08-05 01:49:08 +03:00
|
|
|
LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver
|
2022-08-16 22:00:00 +03:00
|
|
|
ln -s ${test.driver} "$out/driver"
|
2021-03-22 15:19:47 +03:00
|
|
|
'';
|
2021-08-05 01:49:08 +03:00
|
|
|
});
|
2020-01-12 22:52:40 +03:00
|
|
|
in
|
|
|
|
fixedTest
|