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/test-driver: use pythons logging module #96254
Conversation
This way we not accidentally use introduce/use global variables. Also it explictly mark the code for the mypy type checker.
@GrahamcOfBorg test ferm |
edba5a7
to
99f8942
Compare
- Less code - more thread-safe according to @flokli
Haha, I just opened github to open the same PR |
Here's mine for comparison: https://github.com/JJJollyjim/nixpkgs/tree/python-logging |
Personally, I'd like to see automatic (streaming) output to the logger from (not saying that's needed for this PR, of course) |
Appearantly this is used in tests
@GrahamcOfBorg test nsd |
I re-added the |
lgtm :) |
Thanks for this! :-) |
def nested(self, msg: str, attrs: Dict[str, str] = {}) -> _GeneratorContextManager: | ||
my_attrs = {"machine": self.name} | ||
my_attrs.update(attrs) | ||
return self.logger.nested(msg, my_attrs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing Machine.nested
has broken a number of tests that used it, including the channel-blocking chromium test:
$ git grep '\.nested' nixos/tests
nixos/tests/chromium.nix: with machine.nested("Creating a new Chromium window"):
nixos/tests/chromium.nix: with machine.nested("Waiting for new Chromium window to appear"):
nixos/tests/chromium.nix: with machine.nested(description):
nixos/tests/dhparams.nix: with machine.nested("switch to generation ${toString gen}"):
nixos/tests/dhparams.nix: with machine.nested(f"check bit size of {path}"):
nixos/tests/initrd-network-ssh/default.nix: with client.nested("waiting for SSH server to come up"):
nixos/tests/taskserver.nix: with client.nested(f"initialize client for user {user}"):
nixos/tests/taskserver.nix: with client.nested("importing taskwarrior configuration"):
nixos/tests/taskserver.nix: with server.nested("(re-)add imperative user bar"):
nixos/tests/virtualbox.nix: with machine.nested("Checking for privilege escalation"):
nixos/tests/virtualbox.nix: with machine.nested("Checking for privilege escalation"):
…chines-staging" This reverts commit 1bff6fe, reversing changes made to 2995fa4. There’s presumably nothing wrong with this PR, except that it conflicts with reverting NixOS#96254 which broke several tests (NixOS#96699). Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This reverts commit 4fc7085, reversing changes made to 0e54f3a. Fixes NixOS#96699. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Revert “nixos/test-driver: use pythons logging module” (#96254)
This reverts commit 59b6664.
Add changes from NixOS#96254 and NixOS#96152. Remove `Machine.nested` - use `with subtest("Test")` in tests that used `nested`.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)