From 152736d39eeee7ff91274cb3cfe506b4611a37ac Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 17 Jun 2022 11:45:19 +0200 Subject: [PATCH 1/3] nixosTests.acme: Fix typechecking, avoiding type reassignment --- nixos/tests/acme.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/acme.nix b/nixos/tests/acme.nix index 2dd06a50f40b..c07f99c5db3a 100644 --- a/nixos/tests/acme.nix +++ b/nixos/tests/acme.nix @@ -578,7 +578,7 @@ in { webserver.wait_for_unit(f"acme-finished-{test_domain}.target") wait_for_server() check_connection(client, test_domain) - rc, _ = client.execute( + rc, _s = client.execute( f"openssl s_client -CAfile /tmp/ca.crt -connect {test_alias}:443" " /dev/null | openssl x509 -noout -text" f" | grep DNS: | grep {test_alias}" From 2c8bbf33fd84d2fd9de70d66c1f50ac1b6123dd8 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 17 Jun 2022 12:22:57 +0200 Subject: [PATCH 2/3] nixos/test-driver: Support mypy through regular mechanisms --- nixos/lib/test-driver/setup.py | 1 + nixos/lib/testing-python.nix | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/nixos/lib/test-driver/setup.py b/nixos/lib/test-driver/setup.py index 476c7b2dab2a..1719b988db68 100644 --- a/nixos/lib/test-driver/setup.py +++ b/nixos/lib/test-driver/setup.py @@ -4,6 +4,7 @@ setup( 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", diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index a6868a708aaf..4bb1689ffd78 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -119,6 +119,7 @@ rec { { inherit testName; nativeBuildInputs = [ makeWrapper mypy ]; + buildInputs = [ testDriver ]; testScript = testScript'; preferLocalBuild = true; passthru = passthru // { @@ -138,13 +139,10 @@ rec { 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 From 3624bb535f6982e83893f78a57a0770ebb8c672b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 17 Jun 2022 12:24:52 +0200 Subject: [PATCH 3/3] nixosTests.convos: Fix missing port variable --- nixos/tests/convos.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/convos.nix b/nixos/tests/convos.nix index 72275ab390d9..cc0c2e75893c 100644 --- a/nixos/tests/convos.nix +++ b/nixos/tests/convos.nix @@ -23,7 +23,7 @@ in testScript = '' machine.wait_for_unit("convos") - machine.wait_for_open_port(port) + machine.wait_for_open_port(${toString port}) machine.succeed("journalctl -u convos | grep -q 'Listening at.*${toString port}'") machine.succeed("curl -f http://localhost:${toString port}/") '';