Skip to content

Pypy testing no longer xfails#6077

Merged
rwgk merged 6 commits into
pybind:masterfrom
mattip:pypy-xfail-passes
May 27, 2026
Merged

Pypy testing no longer xfails#6077
rwgk merged 6 commits into
pybind:masterfrom
mattip:pypy-xfail-passes

Conversation

@mattip
Copy link
Copy Markdown
Contributor

@mattip mattip commented May 24, 2026

Description

Working through pypy/pypy#5481 and #6049. Fixes to PyPy no longer fail some tests. The xfail tests were marked with xfail(strict=True) (by default strict value), so now that they pass they are marked as failing. I run weekly testing of pybind11 HEAD + pypy HEAD at https://github.com/pypy/binary-testing, you can see the three unexpected tests pass here

Suggested changelog entry:

No changlog entry needed, these are really minor changes in multi-inheritance behavior that I doubt many users hit in practice.


📚 Documentation preview 📚: https://pybind11--6077.org.readthedocs.build/

@mattip mattip force-pushed the pypy-xfail-passes branch from 5dea44b to 5e2c5f9 Compare May 24, 2026 08:07
@rwgk
Copy link
Copy Markdown
Collaborator

rwgk commented May 24, 2026

Hi @mattip, this seems useful for pypy/binary-testing, but I'd prefer to avoid strict=False in the final PR. Instead, we should query the PyPy version in the xfail condition, something like:

@pytest.mark.xfail(
    "env.PYPY and sys.pypy_version_info < fixed_version",
    reason="Fixed in PyPy ...",
)

Or cleaner, add a PYPY_VERSION helper to tests/env.py and use that in the marker.

@mattip
Copy link
Copy Markdown
Contributor Author

mattip commented May 24, 2026

I will do whatever the project wants, but it seems the pattern elsewhere is to add strict=False and not probe sys.pypy_version_info.

 git grep "env.PYPY.*strict=False"
tests/test_buffers.py:    env.PYPY, reason="PyPy 7.3.7 doesn't clear this anymore", strict=False
tests/test_call_policies.py:@pytest.mark.xfail("env.PYPY", reason="sometimes comes out 1 off on PyPy", strict=False)
tests/test_class_sh_disowning_mi.py:@pytest.mark.xfail("env.PYPY", strict=False)
tests/test_class_sh_disowning_mi.py:@pytest.mark.xfail("env.PYPY", strict=False)
tests/test_class_sh_disowning_mi.py:@pytest.mark.xfail("env.PYPY", strict=False)
tests/test_exceptions.py:@pytest.mark.xfail(env.PYPY, reason="Failure on PyPy 3.8 (7.3.7)", strict=False)
tests/test_methods_and_attributes.py:@pytest.mark.xfail("env.PYPY", strict=False)

@rwgk
Copy link
Copy Markdown
Collaborator

rwgk commented May 24, 2026

it seems the pattern elsewhere is to add strict=False and not probe sys.pypy_version_info.

Thanks for pointing out, I wasn't aware. We should probably fix what you found when we get a chance.

strict=False is useful for genuinely flaky tests, but here the behavior appears to have changed deterministically in PyPy. Leaving a broad env.PYPY, strict=False xfail means both "still broken" and "now fixed" remain acceptable indefinitely, so the test stops telling us when the workaround is obsolete or when a real regression appears.

What I'm suggesting is really simple, a few minutes worth of effort or so. It'll help us keep the project healthy. A version-gated xfail keeps the expected-failure window explicit and lets newer PyPy versions exercise the test normally.

@mattip
Copy link
Copy Markdown
Contributor Author

mattip commented May 26, 2026

A version-gated xfail keeps the expected-failure window explicit

Done

@mattip mattip requested a review from henryiii as a code owner May 27, 2026 07:43
@mattip
Copy link
Copy Markdown
Contributor Author

mattip commented May 27, 2026

PyPy 3.11 v7.3.23 was released, so I updated CI to remove the pin. I also removed some CI jobs: pypy2.10 is no longer supported, and macos-x86_64 is a platform that sees little usage.

@mattip
Copy link
Copy Markdown
Contributor Author

mattip commented May 27, 2026

The action is not yet picking up 7.3.23, it is picking up 7.3.22. Maybe later today I will try again.

mattip and others added 2 commits May 27, 2026 14:39
Keep the expected failure for Android and FreeBSD while limiting the PyPy-specific part to versions before 7.3.23. Android CIBW still raises RuntimeError for this test, matching the existing tracked platform issue.
@rwgk
Copy link
Copy Markdown
Collaborator

rwgk commented May 27, 2026

I pushed a fix that should resolve the CIBW Android wheel ubuntu-latest failure: commit 92c47c5

Copy link
Copy Markdown
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

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

Awesome to see the PyPy pinning go. Thanks @mattip!

@rwgk rwgk merged commit 6079989 into pybind:master May 27, 2026
86 checks passed
@github-actions github-actions Bot added the needs changelog Possibly needs a changelog entry label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs changelog Possibly needs a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants