Add an expression for running the test suite

This commit is contained in:
Jean-Paul Calderone 2022-01-27 16:18:43 -05:00
parent 60dd2ee413
commit f03f5fb8d7
2 changed files with 31 additions and 1 deletions

View File

@ -80,6 +80,10 @@ mach-nix.buildPythonPackage {
sha256 = "1md9i2fx1ya7mgcj9j01z58hs3q9pj4ch5is5b5kq4v86cf6x33x";
})
];
};
# Remove a click-default-group patch for a test suite problem which no
# longer applies because the project apparently no longer has a test suite
# in its source distribution.
click-default-group.patches = [];
};
}

26
tests.nix Normal file
View File

@ -0,0 +1,26 @@
let
sources = import nix/sources.nix;
in
# See default.nix for documentation about parameters.
{ pkgsVersion ? "nixpkgs-21.11"
, pkgs ? import sources.${pkgsVersion} { }
, pypiData ? sources.pypi-deps-db
, pythonVersion ? "python37"
, mach-nix ? import sources.mach-nix {
inherit pkgs pypiData;
python = pythonVersion;
}
}@args:
let
# Get the package with all of its test requirements.
tahoe-lafs = import ./. (args // { extras = [ "test" ]; });
# Put it into a Python environment.
python-env = pkgs.${pythonVersion}.withPackages (ps: [
tahoe-lafs
]);
in
# Make a derivation that runs the unit test suite.
pkgs.runCommand "tahoe-lafs-tests" { } ''
${python-env}/bin/python -m twisted.trial -j $NIX_BUILD_CORES allmydata
''