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

pyhon3Packages.deal: fix build by disabling test #211262

Merged
merged 1 commit into from Jan 19, 2023

Conversation

gador
Copy link
Contributor

@gador gador commented Jan 17, 2023

Description of changes

Disable 'test_exception_hook'.
Since commit 6d9c724 (pytest 7.1.3 -> 7.2.0) the test fails.
Official CI builds with pytest 7.1.2. There doesn't seem to be a way to submit an upstream issue.

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/)
  • 23.05 Release Notes (or backporting 22.11 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.

Disable 'test_exception_hook'.
Since commit 6d9c724
(pytest 7.1.3 -> 7.2.0) the test fails.
Official CI builds with pytest 7.1.2. There doesn't seem to
be a way to submit an upstream issue.

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/1722

@@ -77,6 +77,8 @@ buildPythonPackage rec {
"test_scheme_contract_is_satisfied_when_setting_arg"
"test_scheme_contract_is_satisfied_within_chain"
"test_scheme_errors_rewrite_message"
# broken since pytest > 7.1.3
Copy link
Member

Choose a reason for hiding this comment

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

More important what is broken? What's the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Sandro,
the error message is:

_____________________________ test_exception_hook ______________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7ffff1d97bb0>

    def test_exception_hook(capsys):
        pre_path = str(Path('deal', '_runtime', '_contracts.py'))
        f = deal.pre(lambda x: x > 0)(lambda x: x)
        with pytest.raises(deal.PreContractError) as exc_info:
            f(-2)

        # custom hook is registered
        assert sys.excepthook is exception_hook

        # the default hook shows the full traceback
        _excepthook(exc_info.type, exc_info.value, exc_info.tb)
        captured = capsys.readouterr()
        assert captured.out == ''
        assert pre_path in captured.err

        # the custom hook hides deal from the traceback
        exception_hook(exc_info.type, exc_info.value, exc_info.tb)
        captured = capsys.readouterr()
        assert captured.out == ''
        # the hook doesn't work on python 3.6 and below
        if sys.version_info[:2] >= (3, 7):
>           assert pre_path not in captured.err
E           assert 'deal/_runti...contracts.py' not in 'Traceback (...-2\x1b[0m)\n'
E             'deal/_runtime/_contracts.py' is contained here:
E               ld/source/deal/_runtime/_contracts.py", line 87, in wrapper
E                   return contracts._run_sync(args, kwargs)
E                 File "/build/source/deal/_runtime/_contracts.py", line 119, in _run_sync
E                   validator.validate(args, kwargs)
E                 File "/build/source/deal/_runtime/_validators.py", line 175, in _init
E                   self.validate(args, kwargs, exc)...
E
E             ...Full output truncated (4 lines hidden), use '-vv' to show

tests/test_exceptions.py:201: AssertionError

So now the custom hook doesn't seem to hide deal from the stacktrace. My guess was that pytest now includes more output in the stacktrace. I haven't found anything conclusive on the changelog for pytest though. Also all other tests pass and I'm not sure how relevant this error is.
Also since there doesn't seem to be a way to post issues to upstream, this could potentially take some time to fix the test upstream.
Therefore I excluded the test

Copy link
Member

Choose a reason for hiding this comment

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

The comment should probably include that the stacktrace since pytest 7.1.3 no longer matches upstreams assertion.

@thiagokokada
Copy link
Contributor

Result of nixpkgs-review pr 211262 run on x86_64-linux 1

6 packages built:
  • python310Packages.deal
  • python310Packages.icontract
  • python310Packages.pylddwrap
  • python311Packages.deal
  • python311Packages.icontract
  • python311Packages.pylddwrap

@thiagokokada thiagokokada merged commit 4d113bf into NixOS:master Jan 19, 2023
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.

None yet

4 participants