2021-03-22 12:19:47 +00:00
|
|
|
pkgs:
|
2020-01-12 19:52:40 +00:00
|
|
|
let
|
2021-03-22 12:19:47 +00:00
|
|
|
pythonTesting = import "${toString pkgs.path}/nixos/lib/testing-python.nix" {
|
2021-03-22 12:19:48 +00:00
|
|
|
system = pkgs.stdenv.hostPlatform.system;
|
2021-03-22 12:19:47 +00:00
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
in
|
2020-01-12 19:52:40 +00:00
|
|
|
|
2021-03-22 12:19:47 +00:00
|
|
|
args:
|
|
|
|
let
|
|
|
|
test = pythonTesting.makeTest args;
|
2020-01-12 19:52:40 +00:00
|
|
|
|
2021-08-04 22:49:08 +00: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 12:19:47 +00:00
|
|
|
# being garbage-collected
|
|
|
|
fixedTest = test.overrideAttrs (_: {
|
|
|
|
# See `runTests` in nixpkgs/nixos/lib/testing-python.nix for the original definition of `buildCommand`
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir $out
|
2021-08-04 22:49:08 +00:00
|
|
|
LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver
|
|
|
|
ln -s ${test.driver} $out/driver
|
2021-03-22 12:19:47 +00:00
|
|
|
'';
|
2021-08-04 22:49:08 +00:00
|
|
|
});
|
2020-01-12 19:52:40 +00:00
|
|
|
in
|
|
|
|
fixedTest
|