Skip to content

pythonPackages.unittestCheckHook: init#185430

Merged
mweinelt merged 2 commits intoNixOS:stagingfrom
winterqt:python-unittest-hook
Aug 14, 2022
Merged

pythonPackages.unittestCheckHook: init#185430
mweinelt merged 2 commits intoNixOS:stagingfrom
winterqt:python-unittest-hook

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.

@github-actions github-actions bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Aug 6, 2022
@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...?

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.

@ofborg ofborg bot added 8.has: clean-up This PR removes packages or removes other cruft 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Aug 6, 2022
@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 force-pushed the python-unittest-hook branch from 8c7e02c to e4026f7 Compare August 7, 2022 01:34
@github-actions github-actions bot added the 8.has: documentation This PR adds or changes documentation label Aug 7, 2022
@winterqt winterqt force-pushed the python-unittest-hook branch from e4026f7 to 92ba123 Compare August 7, 2022 01:48
@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 winterqt force-pushed the python-unittest-hook branch from 92ba123 to 3c9d334 Compare August 7, 2022 19:41
@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.

@winterqt winterqt force-pushed the python-unittest-hook branch from 26ca2a6 to 19adc33 Compare August 13, 2022 18:09
@bobby285271 bobby285271 added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Aug 14, 2022
@mweinelt mweinelt merged commit 913d759 into NixOS:staging Aug 14, 2022
@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

Labels

6.topic: python Python is a high-level, general-purpose programming language. 8.has: clean-up This PR removes packages or removes other cruft 8.has: documentation This PR adds or changes documentation 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants