nix-bitcoin/test/lib/make-test-vm.nix
Erik Arvstedt ada564c1ea add compatibility with Nix PR #6530 (Source tree abstraction)
Avoid adding flake resource paths to the store (via string
interpolation).
This reduces performance and can lead to modules getting imported
twice, once through a local path and once through a store path.

This might not be needed in a future Nix release, in which case we can
revert this.
2023-06-01 02:56:22 -07:00

26 lines
709 B
Nix

pkgs:
let
pythonTesting = import (pkgs.path + "/nixos/lib/testing-python.nix") {
system = pkgs.stdenv.hostPlatform.system;
inherit pkgs;
};
in
args:
let
test = pythonTesting.makeTest args;
# 1. Save test logging output
# 2. Add link to driver so that a gcroot to a test prevents the driver from
# being garbage-collected
fixedTest = test.overrideAttrs (_: {
# See `runTests` in nixpkgs/nixos/lib/testing-python.nix for the original definition of `buildCommand`
buildCommand = ''
mkdir "$out"
LOGFILE=$out/output.xml tests='exec(os.environ["testScript"])' ${test.driver}/bin/nixos-test-driver
ln -s ${test.driver} "$out/driver"
'';
});
in
fixedTest