Visitar URL original
chains_test's fstat fake breaks pytest 9.2.0's capture, turning deps-latest red · Issue #713 · btclib-org/bitcoin-core-rpc · GitHub
Skip to content

chains_test's fstat fake breaks pytest 9.2.0's capture, turning deps-latest red #713

Closed

Description

@fametrano

tests/chains_test.py::test_a_descriptor_that_cannot_be_inspected_is_closed_and_refused fails under pytest 9.2.0 with OSError: no fstat, raised by the test's own fake. The test replaces os.fstat for the whole process. pytest 9.2.0's fd-level capture now calls os.fstat on its own buffer after the call phase (pytest-dev/pytest#14687), before the monkeypatch is undone, and gets the fake. cookie_auth itself behaves: the pytest.raises and the descriptor count both pass first.

The fix is in the test: the fake fails only for the cookie file's descriptor and hands every other descriptor to the real os.fstat.

What happens

deps-latest is red on main (b6491d8): https://github.com/btclib-org/bitcoin-core-rpc/actions/runs/40672783964, scheduled 2026-10-28. The four ubuntu and macos suite cells fail on this one test; windows skips it (no /dev/fd). The run's upgrade moved pytest from 9.1.1 (the lock) to 9.2.0. Expected: the suite passes at latest, as it does at the lock.

How to reproduce it

# on origin/main, at the lock: 1 passed
#   uv run pytest --no-cov -n 0 "tests/chains_test.py::test_a_descriptor_that_cannot_be_inspected_is_closed_and_refused"
# after `uv lock --upgrade` (pytest 9.2.0): 1 failed, --tb=native shows
#   _pytest/capture.py, line 595, in snap
#     if os.fstat(self.tmpfile.fileno()).st_size == 0:
#   tests/chains_test.py, line 331, in failing_fstat
#     raise OSError("no fstat")

Version

main at b6491d8

Bitcoin Core version

none: a test-suite failure, no node involved

Platform and interpreter

CPython 3.11 and 3.15, ubuntu-latest and macos-latest (CI); CPython 3.11.15, macOS arm64 (local)

Activity

  1. added a commit that references this issue on Oct 29, 2026
    22fb92a
  2. added a commit that references this issue on Oct 29, 2026
    6020f10
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions