nixos/test-driver: Support mypy through regular mechanisms

This commit is contained in:
Robert Hensing 2022-06-17 12:22:57 +02:00
parent 152736d39e
commit 2c8bbf33fd
2 changed files with 2 additions and 3 deletions

View file

@ -4,6 +4,7 @@ setup(
name="nixos-test-driver", name="nixos-test-driver",
version='1.1', version='1.1',
packages=find_packages(), packages=find_packages(),
package_data={"test_driver": ["py.typed"]},
entry_points={ entry_points={
"console_scripts": [ "console_scripts": [
"nixos-test-driver=test_driver:main", "nixos-test-driver=test_driver:main",

View file

@ -119,6 +119,7 @@ rec {
{ {
inherit testName; inherit testName;
nativeBuildInputs = [ makeWrapper mypy ]; nativeBuildInputs = [ makeWrapper mypy ];
buildInputs = [ testDriver ];
testScript = testScript'; testScript = testScript';
preferLocalBuild = true; preferLocalBuild = true;
passthru = passthru // { passthru = passthru // {
@ -138,13 +139,10 @@ rec {
echo "${builtins.toString vlanNames}" >> testScriptWithTypes echo "${builtins.toString vlanNames}" >> testScriptWithTypes
echo -n "$testScript" >> testScriptWithTypes echo -n "$testScript" >> 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