nixos/test-driver: Support mypy through regular mechanisms

Changed files
+2 -3
nixos
lib
+1
nixos/lib/test-driver/setup.py
···
name="nixos-test-driver",
version='1.1',
packages=find_packages(),
entry_points={
"console_scripts": [
"nixos-test-driver=test_driver:main",
···
name="nixos-test-driver",
version='1.1',
packages=find_packages(),
+
package_data={"test_driver": ["py.typed"]},
entry_points={
"console_scripts": [
"nixos-test-driver=test_driver:main",
+1 -3
nixos/lib/testing-python.nix
···
{
inherit testName;
nativeBuildInputs = [ makeWrapper mypy ];
testScript = testScript';
preferLocalBuild = true;
passthru = passthru // {
···
echo "${builtins.toString vlanNames}" >> 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 \
--pretty \
--no-color-output \
testScriptWithTypes
-
unset PYTHONPATH
''}
echo -n "$testScript" >> $out/test-script
···
{
inherit testName;
nativeBuildInputs = [ makeWrapper mypy ];
+
buildInputs = [ testDriver ];
testScript = testScript';
preferLocalBuild = true;
passthru = passthru // {
···
echo "${builtins.toString vlanNames}" >> testScriptWithTypes
echo -n "$testScript" >> testScriptWithTypes
mypy --no-implicit-optional \
--pretty \
--no-color-output \
testScriptWithTypes
''}
echo -n "$testScript" >> $out/test-script