Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/python-test-driver: add option to disable the linter without warning #96515

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions nixos/lib/testing-python.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ rec {
, name ? "unnamed"
# Skip linting (mainly intended for faster dev cycles)
, skipLint ? false
# Skip linting without displaying a warning (do not use for tests in Nixpkgs)
, skipLintSilently ? false
, ...
} @ t:

Expand Down Expand Up @@ -117,7 +119,9 @@ rec {
# Generate convenience wrappers for running the test driver
# interactively with the specified network, and for starting the
# VMs from the command line.
driver = let warn = if skipLint then lib.warn "Linting is disabled!" else lib.id; in warn (runCommand testDriverName
driver = let
warn = if skipLint && !skipLintSilently then lib.warn "Linting is disabled!" else lib.id;
in warn (runCommand testDriverName
{ buildInputs = [ makeWrapper];
testScript = testScript';
preferLocalBuild = true;
Expand All @@ -127,7 +131,7 @@ rec {
mkdir -p $out/bin

echo -n "$testScript" > $out/test-script
${lib.optionalString (!skipLint) ''
${lib.optionalString (!(skipLint || skipLintSilently)) ''
${python3Packages.black}/bin/black --check --diff $out/test-script
''}

Expand Down