Skip to content

nixos/lib/test-driver: fix linting after compatibility clean‐up#359060

Merged
emilazy merged 1 commit intoNixOS:stagingfrom
emilazy:push-kkpzmrxlusou
Nov 25, 2024
Merged

nixos/lib/test-driver: fix linting after compatibility clean‐up#359060
emilazy merged 1 commit intoNixOS:stagingfrom
emilazy:push-kkpzmrxlusou

Conversation

@emilazy
Copy link
Member

@emilazy emilazy commented Nov 25, 2024

The previous commit removed the handling of dict arguments, but didn’t adjust the type, leading to the following type-checking error:

test_driver/driver.py:216: error: Argument 1 to "NixStartScript" has incompatible type "str | dict[Any, Any]"; expected "str"  [arg-type]

It also left an unused import that Ruff is unhappy about:

build/lib/test_driver/driver.py:11:22: F401 [*] `colorama.Fore` imported but unused
…
build/lib/test_driver/driver.py:11:28: F401 [*] `colorama.Style` imported but unused

Fixes: 71306e6

cc @wolfgangwalther

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux nixosTests.simple
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

The previous commit removed the handling of `dict` arguments, but
didn’t adjust the type, leading to the following type-checking error:

    test_driver/driver.py:216: error: Argument 1 to "NixStartScript" has incompatible type "str | dict[Any, Any]"; expected "str"  [arg-type]

It also left an unused import that Ruff is unhappy about:

    build/lib/test_driver/driver.py:11:22: F401 [*] `colorama.Fore` imported but unused
    …
    build/lib/test_driver/driver.py:11:28: F401 [*] `colorama.Style` imported but unused

Fixes: 71306e6
@emilazy emilazy requested a review from K900 November 25, 2024 17:21
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: testing Tooling for automated testing of packages and modules labels Nov 25, 2024
@nix-owners nix-owners bot requested a review from tfc November 25, 2024 17:22
Copy link
Contributor

@wolfgangwalther wolfgangwalther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning up after my cleanup.

Comment on lines -11 to -12
from colorama import Fore, Style

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked, colorama is still used in logger.py, so we can't remove it as a nix dep entirely.

@emilazy emilazy merged commit 25260cd into NixOS:staging Nov 25, 2024
@emilazy emilazy deleted the push-kkpzmrxlusou branch November 25, 2024 17:32
@github-actions
Copy link
Contributor

Successfully created backport PR for staging-24.11:

@emilazy
Copy link
Member Author

emilazy commented Nov 25, 2024

Probably best to test that at least one NixOS test can pass after making test driver changes 😅 Thankfully it was an easy fix (and staging breakage doesn’t hurt too much).

@wolfgangwalther
Copy link
Contributor

Right... I think I ran more tests on the bigger branch going into master, but not so much on staging.

@wolfgangwalther
Copy link
Contributor

What I would really like to have... is a some kind of tool / script that would cherry-pick a change from a staging-based branch to master, then test it there. This is what I do manually most of the time, but it's annoying.

Do you know any such tool already or is that something I'd have to write myself?

@emilazy
Copy link
Member Author

emilazy commented Nov 25, 2024

When your change doesn’t depend on stuff already in staging, the correct thing to do is to base your change on git merge-base upstream/master upstream/staging. That way you get the closest thing to master that still merges cleanly into staging. (It would just be master if not for the delay of the periodic masterstaging-nextstaging merge job.)

Of course, that means that you don’t test your change against all the other changes in staging – for that, you simply need a Big Computer. (Have you considered requesting accounts on the community builders?)

@wolfgangwalther
Copy link
Contributor

When your change doesn’t depend on stuff already in staging, the correct thing to do is to base your change on git merge-base upstream/master upstream/staging. That way you get the closest thing to master that still merges cleanly into staging. (It would just be master if not for the delay of the periodic masterstaging-nextstaging merge job.)

Ah. I hadn't considered this. Right, this would make a lot of sense.

Of course, that means that you don’t test your change against all the other changes in staging – for that, you simply need a Big Computer. (Have you considered requesting accounts on the community builders?)

I think the machine is actually big enough. I do have an account on the darwin community builder, too.

Will try the merge-base approach and see how that goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: testing Tooling for automated testing of packages and modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants