From c362a28fcf2621fd3b6d6a96c821e9af9d123e21 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 8 May 2021 16:57:02 +0200 Subject: nixos/testing: Switch from black to pyflakes So far, we have used "black" for formatting the test code, which is rather strict and opinionated and when used inline in Nix expressions it creates all sorts of trouble. One of the main annoyances is that when using strings coming from Nix expressions (eg. store paths or option definitions from NixOS modules), completely unrelated changes could cause tests to fail, since eg. black wants lines to be broken. Another downside of enforcing a certain kind of formatting is that it makes the Nix expression code inconsistent because we're mixing two spaces of indentation (common in nixpkgs) with four spaces of indentation as defined in PEP-8. While this is perfectly fine for standalone Python files, it really looks ugly and inconsistent IMO when used within Nix strings. What we actually want though is a linter that catches problems early on before actually running the test, because this is *actually* helping in development because running the actual VM test takes much longer. This is the reason why I switched from black to pyflakes, because the latter actually has useful checks, eg. usage of undefined variables, invalid format arguments, duplicate arguments, shadowed loop vars and more. Signed-off-by: aszlig Closes: https://github.com/NixOS/nixpkgs/issues/72964 --- nixos/lib/testing-python.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nixos/lib/testing-python.nix') diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index 6497b897eaf..6327f7a10a3 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -159,7 +159,7 @@ rec { echo -n "$testScript" > $out/test-script ${lib.optionalString (!skipLint) '' - ${python3Packages.black}/bin/black --check --diff $out/test-script + ${python3Packages.pyflakes}/bin/pyflakes $out/test-script ''} ln -s ${testDriver}/bin/nixos-test-driver $out/bin/ -- cgit 1.4.1