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

pythonPackages.unittestCheckHook: init #185430

Merged
merged 2 commits into from
Aug 14, 2022

Conversation

winterqt
Copy link
Member

@winterqt winterqt commented Aug 6, 2022

Description of changes

This adds a new hook, unittestCheckHook, that runs python -m unittest discover, as well as migrating the majority of packages that use unittest to it.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 22.11 Release Notes (or backporting 22.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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@winterqt winterqt force-pushed the python-unittest-hook branch 2 times, most recently from 8f60b9e to 8c7e02c Compare August 6, 2022 17:28
@winterqt
Copy link
Member Author

winterqt commented Aug 6, 2022

Wonder why ofborg-eval-package-list never failed with the previous commits (when it should have).

Edit, hours later: but it did for the same type of problem just now...?

echo "Executing unittestCheckPhase"
runHook preCheck

eval "@pythonCheckInterpreter@ -m unittest discover $unittestFlags"
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if this is the best way to do things.

The issue that I ran into was that if I did python -m unittest discover "${unittestFlags[@]}", a flags value of [ "-s" "tests" ] would expand to a single argument, -s tests, which argparse (which unittest uses) would parse as the value for the -s argument being tests (with a space).

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

That's basically doing what I'm doing here, as far as I can tell -- I believe it has to do that specifically so it can add its own arguments if needed.

@winterqt
Copy link
Member Author

winterqt commented Aug 6, 2022

I don't like that OfBorg added the clean up label, though I don't think it gives specifics as to why. 😕

As far as I know, I fixed every issue that caused packages to not eval, so I'm not sure what else it would be adding that for (even if it should fail for that)...

@winterqt winterqt marked this pull request as ready for review August 7, 2022 01:54
@SuperSandro2000
Copy link
Member

I don't like that OfBorg added the clean up label, though I don't think it gives specifics as to why. confused

don't worry about it. I am not sure what triggered it but maybe the treewide change.

@FRidh
Copy link
Member

FRidh commented Aug 7, 2022

As it is now, the unittest hook should be added to checkInputs, but after #185406 it needs to go to nativeCheckInputs.

@winterqt
Copy link
Member Author

winterqt commented Aug 7, 2022

As it is now, the unittest hook should be added to checkInputs

Fixed.

@winterqt winterqt force-pushed the python-unittest-hook branch 3 times, most recently from be6acc7 to 26ca2a6 Compare August 13, 2022 03:41
Copy link
Member

@mweinelt mweinelt left a comment

Choose a reason for hiding this comment

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

Looks good to me, one more nit.

pkgs/development/interpreters/python/hooks/default.nix Outdated Show resolved Hide resolved
@vcunat
Copy link
Member

vcunat commented Aug 19, 2022

This broke tests in .bitstring: https://hydra.nixos.org/build/187598212
(the "treewide" commit, according to my bisect)

@winterqt
Copy link
Member Author

Yes, someone already noted that -- there's a quick fix but also a more proper one that should be upstreamed. See https://matrix.to/#/!kjdutkOsheZdjqYmqp%3Anixos.org/%24_WKyurbQoNXb49piMvNidpULeGz7zFJh-LFM4HoAttE

@winterqt winterqt deleted the python-unittest-hook branch August 19, 2022 19:15
@vcunat
Copy link
Member

vcunat commented Aug 20, 2022

In PR #187531

@vcunat
Copy link
Member

vcunat commented Aug 21, 2022

Other regressions probably won't have significant impact, but let me post them here anyway, in case someone's interested:

@winterqt
Copy link
Member Author

I made #187778 to fix regressions (drafted until latest eval completes).

e1mo added a commit to e1mo/nixpkgs that referenced this pull request Sep 17, 2022
In NixOS#185430 the `unittestCheckHook` argument was introduced, causing the
derivation to fail building since the `unittestCheckHook` is not passed.
However the original PR already used the `unittestCheckHook` from
`python3Packages`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants