nixos/testing: Support mypy through regular mechanisms

Rebase / forward port of 2c8bbf33fd
This commit is contained in:
Robert Hensing 2022-06-26 13:57:58 +02:00
parent 9303a3c73b
commit 52bfa318e8

View file

@ -52,6 +52,7 @@ let
nativeBuildInputs = [ nativeBuildInputs = [
hostPkgs.makeWrapper hostPkgs.makeWrapper
] ++ lib.optionals (!config.skipTypeCheck) [ hostPkgs.mypy ]; ] ++ lib.optionals (!config.skipTypeCheck) [ hostPkgs.mypy ];
buildInputs = [ testDriver ];
testScript = config.testScriptString; testScript = config.testScriptString;
preferLocalBuild = true; preferLocalBuild = true;
passthru = config.passthru; passthru = config.passthru;
@ -73,13 +74,10 @@ let
cat -n testScriptWithTypes cat -n testScriptWithTypes
# set pythonpath so mypy knows where to find the imports. this requires the py.typed file.
export PYTHONPATH='${../test-driver}'
mypy --no-implicit-optional \ mypy --no-implicit-optional \
--pretty \ --pretty \
--no-color-output \ --no-color-output \
testScriptWithTypes testScriptWithTypes
unset PYTHONPATH
''} ''}
echo -n "$testScript" >> $out/test-script echo -n "$testScript" >> $out/test-script