Merge pull request #76171 from Ma27/optionally-disable-python-lint
nixos/python-test-driver: add an option to disable python linter
This commit is contained in:
commit
9dacdec2d9
|
@ -419,4 +419,23 @@ machine.wait_for_unit("xautolock.service", "x-session-user")
|
||||||
<literal>wait_for_unit</literal>, <literal>start_job</literal> and
|
<literal>wait_for_unit</literal>, <literal>start_job</literal> and
|
||||||
<literal>stop_job</literal>.
|
<literal>stop_job</literal>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
For faster dev cycles it's also possible to disable the code-linters (this shouldn't
|
||||||
|
be commited though):
|
||||||
|
<programlisting>
|
||||||
|
import ./make-test-python.nix {
|
||||||
|
skipLint = true;
|
||||||
|
machine =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{ <replaceable>configuration…</replaceable>
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
''
|
||||||
|
<replaceable>Python code…</replaceable>
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -95,6 +95,8 @@ in rec {
|
||||||
, makeCoverageReport ? false
|
, makeCoverageReport ? false
|
||||||
, enableOCR ? false
|
, enableOCR ? false
|
||||||
, name ? "unnamed"
|
, name ? "unnamed"
|
||||||
|
# Skip linting (mainly intended for faster dev cycles)
|
||||||
|
, skipLint ? false
|
||||||
, ...
|
, ...
|
||||||
} @ t:
|
} @ t:
|
||||||
|
|
||||||
|
@ -133,7 +135,7 @@ in rec {
|
||||||
# Generate onvenience wrappers for running the test driver
|
# Generate onvenience wrappers for running the test driver
|
||||||
# interactively with the specified network, and for starting the
|
# interactively with the specified network, and for starting the
|
||||||
# VMs from the command line.
|
# 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];
|
{ buildInputs = [ makeWrapper];
|
||||||
testScript = testScript';
|
testScript = testScript';
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
@ -143,7 +145,9 @@ in rec {
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
|
||||||
echo -n "$testScript" > $out/test-script
|
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/
|
ln -s ${testDriver}/bin/nixos-test-driver $out/bin/
|
||||||
vms=($(for i in ${toString vms}; do echo $i/bin/run-*-vm; done))
|
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 tests 'start_all(); join_all();' \
|
||||||
--set VLANS '${toString vlans}' \
|
--set VLANS '${toString vlans}' \
|
||||||
${lib.optionalString (builtins.length vms == 1) "--set USE_SERIAL 1"}
|
${lib.optionalString (builtins.length vms == 1) "--set USE_SERIAL 1"}
|
||||||
''; # "
|
''); # "
|
||||||
|
|
||||||
passMeta = drv: drv // lib.optionalAttrs (t ? meta) {
|
passMeta = drv: drv // lib.optionalAttrs (t ? meta) {
|
||||||
meta = (drv.meta or {}) // t.meta;
|
meta = (drv.meta or {}) // t.meta;
|
||||||
|
|
Loading…
Reference in New Issue