GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 8.3.4: approx broken when mixing numpy booleans and booleans · Issue #13047 · pytest-dev/pytest

8.3.4: approx broken when mixing numpy booleans and booleans #13047

New issue
Copy link
New issue
Copy link
Closed
#13338
Closed
8.3.4: approx broken when mixing numpy booleans and booleans#13047
#13338
Copy link
Labels
type: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

Description

@t-b
t-b
opened on Dec 9, 2024
Issue body actions

After updating to pytest 8.3.4 the following code

Python 3.11.10 (main, Nov 20 2024, 15:38:42) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytest
>>> import numpy as np
>>> np.False_ == pytest.approx(False)

returns False where as it returns True with pytest 8.3.3. I would not expect to have to update my code when updating to a patch version.

I would think, without having any clue, that #9354, is the culprit.

$pip list
Package    Version
---------- -------
iniconfig  2.0.0
numpy      2.2.0
packaging  24.2
pip        24.0
pluggy     1.5.0
pytest     8.3.4
setuptools 65.5.0

OS: debian bookworm

Activity

  1. RonnyPfannschmidt commented on Dec 9, 2024

    @RonnyPfannschmidt
    RonnyPfannschmidt
    on Dec 9, 2024
    Member
    More actions

    Indeed

  2. RonnyPfannschmidt
    added
    type: bugproblem that needs to be addressed
    type: regressionindicates a problem that was introduced in a release which was working previously
    on Dec 9, 2024
  3. nicoddemus commented on Dec 10, 2024

    @nicoddemus
    nicoddemus
    on Dec 10, 2024
    Member
    More actions

    I would not expect to have to update my code when updating to a patch version.

    Indeed, unfortunately even though we try our best, sometimes a bug fix might unexpectedly break a valid/existing case.

    This is strange however, seems like the post example should work given that we have explicit tests for bool:

        def test_expecting_bool(self) -> None:
            assert True == approx(True)  # noqa: E712
            assert False == approx(False)  # noqa: E712
            assert True != approx(False)  # noqa: E712
            assert True != approx(False, abs=2)  # noqa: E712
            assert 1 != approx(True)

    I guess throwing numpy.bool in the mix is causing unexpected problems.

  4. t-b commented on Dec 15, 2024

    @t-b
    t-b
    on Dec 15, 2024
    Author
    More actions

    Thanks both. Sorry for my wording. The rabbit hole got a bit too deep when debugging the problem and finding a pytest bug.

  5. malangsiddharth
    added a commit that references this issue on Jan 14, 2025

    Fix issue pytest-dev#13047: Handle numpy booleans in pytest.approx

    1f27474
  6. BahramF73
    added a commit that references this issue on Mar 31, 2025

    Fix for issue pytest-dev#13047

    37367f9
  7. nicoddemus
    closed this as completedin #13338on Apr 2, 2025
  8. nicoddemus
    added a commit that references this issue on Apr 2, 2025

    Fix `approx` when mixing numpy.bool and bool (#13338)

    This issue will close once commit 0c45497 is merged into the 'main' branch.
    0c45497
  9. patchback
    added a commit that references this issue on Apr 2, 2025

    Fix `approx` when mixing numpy.bool and bool (#13338)

    This issue will close once commit 16c540f is merged into the 'main' branch.
    16c540f
  10. nicoddemus
    added a commit that references this issue on Apr 2, 2025

    Fix `approx` when mixing numpy.bool and bool (#13338) (#13342)

    This issue will close once commit 70d0c9d is merged into the 'main' branch.
    70d0c9d
  11. luketainton
    added a commit that references this issue on Jan 5, 2026

    chore(deps): update dependency pytest to v9 (#305)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.