diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2019-12-22 14:50:08 +0100 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2019-12-22 19:27:43 +0100 |
commit | b72661749bb03a60c86590208aef2760c73f3892 (patch) | |
tree | 15c18cea2635513fe823653d39b8ed757fa674b6 /nixos/lib/testing-python.nix | |
parent | 7675c0b2a98f60f8ac85208af9a716939ce29cd4 (diff) |
nixos/python-test-driver: add an option to disable python linter
While it's a good idea to automate the linting of the python code used for our tests, I think that it can be quite distracting when hacking on a NixOS test. I figured that it might be more convenient to add an option as a shortcut for this to avoid that everyone needs to dig into the test driver again.
Diffstat (limited to 'nixos/lib/testing-python.nix')
-rw-r--r-- | nixos/lib/testing-python.nix | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index c4eb9328b1db1..3d09be3b6cd50 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -95,6 +95,8 @@ in rec { , makeCoverageReport ? false , enableOCR ? false , name ? "unnamed" + # Skip linting (mainly intended for faster dev cycles) + , skipLint ? false , ... } @ t: @@ -133,7 +135,7 @@ in rec { # Generate onvenience wrappers for running the test driver # interactively with the specified network, and for starting the # VMs from the command line. - driver = runCommand testDriverName + driver = let warn = if skipLint then lib.warn "Linting is disabled!" else lib.id; in warn (runCommand testDriverName { buildInputs = [ makeWrapper]; testScript = testScript'; preferLocalBuild = true; @@ -143,7 +145,9 @@ in rec { mkdir -p $out/bin echo -n "$testScript" > $out/test-script - ${python3Packages.black}/bin/black --check --diff $out/test-script + ${lib.optionalString (!skipLint) '' + ${python3Packages.black}/bin/black --check --diff $out/test-script + ''} ln -s ${testDriver}/bin/nixos-test-driver $out/bin/ vms=($(for i in ${toString vms}; do echo $i/bin/run-*-vm; done)) @@ -160,7 +164,7 @@ in rec { --set tests 'start_all(); join_all();' \ --set VLANS '${toString vlans}' \ ${lib.optionalString (builtins.length vms == 1) "--set USE_SERIAL 1"} - ''; # " + ''); # " passMeta = drv: drv // lib.optionalAttrs (t ? meta) { meta = (drv.meta or {}) // t.meta; |