2021-03-22 05:19:47 -07:00
|
|
|
pkgs:
|
2020-01-12 11:52:40 -08:00
|
|
|
let
|
2021-03-22 05:19:47 -07:00
|
|
|
pythonTesting = import "${toString pkgs.path}/nixos/lib/testing-python.nix" {
|
2021-03-22 05:19:48 -07:00
|
|
|
system = pkgs.stdenv.hostPlatform.system;
|
2021-03-22 05:19:47 -07:00
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
in
|
2020-01-12 11:52:40 -08:00
|
|
|
|
2021-03-22 05:19:47 -07:00
|
|
|
args:
|
|
|
|
let
|
|
|
|
test = pythonTesting.makeTest args;
|
2020-01-12 11:52:40 -08:00
|
|
|
|
2021-08-04 15:49:08 -07: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 05:19:47 -07: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 12:00:00 -07:00
|
|
|
mkdir "$out"
|
2021-08-04 15:49:08 -07:00
|
|
|
LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver
|
2022-08-16 12:00:00 -07:00
|
|
|
ln -s ${test.driver} "$out/driver"
|
2021-03-22 05:19:47 -07:00
|
|
|
'';
|
2021-08-04 15:49:08 -07:00
|
|
|
});
|
2020-01-12 11:52:40 -08:00
|
|
|
in
|
|
|
|
fixedTest
|