[bitcoin/bitcoin] [Tests] Make p2p_segwit easier to debug (#13467)

`p2p_segwit.py` is a very long test, composed of multiple subtests. When it fails it’s difficult to debug for a couple of reasons:

— Control flow jumps between different methods in the test class, so it’s a little difficult to follow the code.
— state may be carried forward unintentionally from one subtest to the next.

Improve that by wrapping the subtests with a `@subtest` decorator which:
— logs progress
— asserts state after each subtest

As usual, I’ve also included a few commits which generally tidy up the test and improve style.
You can view, comment on, or merge this pull request online at:

https://github.com/bitcoin/bitcoin/pull/13467

— Commit Summary —

* [tests] p2p_segwit: Fix flake8 warnings.
* [tests] p2p_segwit: Make sure each subtest leaves utxos for the next.
* [tests] p2p_segwit: standardise comments/docstrings.
* [tests] p2p_segwit: re-order function definitions.
* [tests] p2p_segwit: wrap subtests with subtest wrapper.
* [tests] p2p_segwit: log and assert segwit status in subtest wrapper.
* [tests] p2p_segwit: remove unnecessary arguments from subtests.
* [tests] p2p_segwit: sync_blocks in subtest wrapper.

— File Changes —

M test/functional/p2p_segwit.py (1920)

— Patch Links —

https://github.com/bitcoin/bitcoin/pull/13467.patch
https://github.com/bitcoin/bitcoin/pull/13467.diff

Добавить комментарий