• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Chia-Network / chia-blockchain / 26457138893

26 May 2026 03:13PM UTC coverage: 91.478% (-0.01%) from 91.489%
26457138893

push

github

web-flow
fix monkeypatching in tests to not leak into other tests (#20933)

### Purpose:

It was not failing on CI because we run smaller groups of tests, but
when running all tests in a single command, there would be failures.

This PR also revertes a recent patch to mitigate this issue.

### Current Behavior:

when running command line/CLI tests, we would not restore the
monkeypatches. This caused later tests running in the same process to
fail.

### New Behavior:

`create_service_and_wallet_client_generators` takes a
`pytest.MonkeyPatch` parameter and uses `monkeypatch.setattr()` for all
5 patches. The conftest wraps
it in `pytest.MonkeyPatch.context()`, which handles save/restore
automatically.

### Testing Notes:

<!-- Attach any visual examples, or supporting evidence (attach any
.gif/video/console output below) -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: test-only changes that adjust how monkeypatching is applied
and automatically reverted; main potential issue is missing a patch or
incorrect scoping causing CLI tests to fail.
> 
> **Overview**
> Fixes CLI command tests leaking monkeypatched RPC helpers into later
tests by changing `create_service_and_wallet_client_generators` to
accept a `pytest.MonkeyPatch` and applying patches via
`monkeypatch.setattr()`.
> 
> Updates the `get_test_cli_clients` fixture to wrap setup in
`pytest.MonkeyPatch.context()`, ensuring all patched functions (RPC
client generators and `cli_confirm`) are automatically restored after
the fixture exits, and removes now-unneeded test RPC methods (`log_in`,
`get_pool_login_link`) tied to those patches.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
08788c422. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

10831 of 12032 branches covered (90.02%)

Branch coverage included in aggregate %.

10 of 10 new or added lines in 2 files covered. (100.0%)

34 existing lines in 6 files now uncovered.

111775 of 121996 relevant lines covered (91.62%)

1.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.54
/chia/full_node/full_node_api.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc