Skip to content

Relax code style checks in python testing driver's testScripts's #72964

@worldofpeace

Description

@worldofpeace

Describe the bug
Currently the python testing driver runs this check on each test script

black --check --diff ${testDriverScript}

And this is great because it ensures a good code style within the testing scripts.
But unfortunately it isn't as straightforward as this, I can think of couple cases already where this can cause headaches for people

  • generated testing scripts/injected

I wrote

recently and it can error out on the final testing script, but that is already abstracted by this function so it doesn't really matter. I had to make special measure to try to appease black.

  • nix store paths/nix values

We used nix to keep line width manageable in this test

but if I were to port this to python I'd need to format the code like

machine.wait_until_succeeds(
    "su - alice -c '${startingUp} | grep -q true,..false'"
)

because those values get interpolated and then became really long.
Same if you use a nix store path attribute anywhere, it'll likely error out on the line being too long.

Solutions
We need to relax a lot of black's settings.
@adisbladis pasted these, as to what they're using personally:

And for sure relax string literal lengths to be larger, because of the reasons I mentioned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS6.topic: testingTooling for automated testing of packages and modules

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions