|
Ran
|
Jobs
1
|
Files
922
|
Run time
3min
|
Badge
README BADGES
|
push
github
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
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 25 |
77.42 |
-12.9% | chia/_tests/core/util/test_lockfile.py |
| 3 |
88.54 |
-0.07% | chia/full_node/full_node_api.py |
| 2 |
72.52 |
-0.32% | chia/farmer/farmer.py |
| 2 |
88.36 |
0.0% | chia/full_node/full_node.py |
| 1 |
90.83 |
1.89% | chia/_tests/cmds/cmd_test_utils.py |
| 1 |
87.23 |
0.0% | chia/wallet/wallet_node.py |
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 26457138893.1 | 1844 |
91.48 |
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
|---|