Newer
Older
, hypothesisProfile ? null
, collectCoverage ? false
, testSuite ? null
, trialArgs ? null
, ...
}@args:
let
inherit (privatestorage) pkgs mach-nix zkapauthorizer;
hypothesisProfile' = if hypothesisProfile == null then "default" else hypothesisProfile;
defaultTrialArgs = [ "--rterrors" ] ++ (lib.optional (! collectCoverage) "--jobs=$(($NIX_BUILD_CORES > 8 ? 8 : $NIX_BUILD_CORES))");
trialArgs' = if trialArgs == null then defaultTrialArgs else trialArgs;
extraTrialArgs = builtins.concatStringsSep " " trialArgs';
testSuite' = if testSuite == null then "_zkapauthorizer" else testSuite;
python = mach-nix.mkPython {
inherit (zkapauthorizer.meta.mach-nix) python providers;
requirements =
packagesExtra = [ zkapauthorizer ];
_.hypothesis.postUnpack = "";
};
lint-python = mach-nix.mkPython {
python = "python39";
requirements = ''
isort
black
${lint-python}/bin/black --check src
${lint-python}/bin/isort --check src
ZKAPAUTHORIZER_HYPOTHESIS_PROFILE=${hypothesisProfile'} ${python}/bin/python -m ${if collectCoverage
then "coverage run --debug=config --rcfile=${zkapauthorizer.src}/.coveragerc --module"
else ""
} twisted.trial ${extraTrialArgs} ${testSuite'}
''
mkdir -p "$out/coverage"
cp -v .coverage.* "$out/coverage"
''
}