depot/third_party/nixpkgs/pkgs/development/python-modules/pykcs11/tests.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

33 lines
677 B
Nix

{
buildPythonPackage,
asn1crypto,
pykcs11,
pytestCheckHook,
softhsm,
}:
buildPythonPackage {
pname = "pykcs11-tests";
inherit (pykcs11) version;
format = "other";
src = pykcs11.testout;
dontBuild = true;
dontInstall = true;
nativeCheckInputs = [
asn1crypto
pykcs11
pytestCheckHook
];
preCheck = ''
export HOME=$(mktemp -d)
export PYKCS11LIB=${softhsm}/lib/softhsm/libsofthsm2.so
export SOFTHSM2_CONF=$HOME/softhsm2.conf
echo "directories.tokendir = $HOME/tokens" > $HOME/softhsm2.conf
mkdir $HOME/tokens
${softhsm}/bin/softhsm2-util --init-token --label "A token" --pin 1234 --so-pin 123456 --slot 0
'';
}