dash/test/functional/test_framework
MarcoFalke 40420195be
Merge #19804: test/refactor: reference p2p objects explicitly and remove confusing Test_Node.p2p property
10d61505fe77880d6989115defa5e08417f3de2d [test] remove confusing p2p property (gzhao408)
549d30faf04612d9589c81edf9770c99e3221885 scripted-diff: replace p2p with p2ps[0] in p2p_invalid_tx (gzhao408)
7a0de46aeafb351cffa3410e1aae9809fd4698ad [doc] sample code for test framework p2p objects (gzhao408)
784f757994c1306bb6584b14c0c78617d6248432 [refactor] clarify tests by referencing p2p objects directly (gzhao408)

Pull request description:

  The `TestNode` has a `p2p` property which is an alias for `p2ps[0]`.

  I think this should be removed because it can be confusing and misleading (to both the test writer and reviewer), especially if a TestNode has multiple p2ps connected (which is the case for many tests).
  Another example is when a test has multiple subtests that connect 1 p2p and use the `p2p` property to reference it. If the subtests don't completely clean up after themselves, the subtests may affect one another.

  The best way to refer to a connected p2p is use the object returned by `add_p2p_connection` like this:
  ```py
  p2p_conn = node.add_p2p_connection(P2PInterface())
  ```
  A good example is [p2p_invalid_locator.py](https://github.com/bitcoin/bitcoin/blob/master/test/functional/p2p_invalid_locator.py), which cleans up after itself (waits in both `wait_for_disconnect` and in `disconnect_p2ps`) but wouldn't need so much complexity if it just referenced the connections directly.

  If there is only one connected, it's not really that tedious to just use `node.p2ps[0]` instead of `node.p2p` (and it can always be aliased inside the test itself).

ACKs for top commit:
  robot-dreams:
    utACK 10d61505fe77880d6989115defa5e08417f3de2d
  jnewbery:
    utACK 10d61505fe77880d6989115defa5e08417f3de2d
  guggero:
    Concept ACK 10d61505.

Tree-SHA512: 5965548929794ec660dae03467640cb2156d7d826cefd26d3a126472cbc2494b855c1d26bbb7b412281fbdc92b9798b9765a85c27bc1a97f7798f27f64db6f13
2024-01-27 22:55:29 -06:00
..
__init__.py
address.py Merge #18965: tests: implement base58_decode 2023-12-06 12:33:15 -06:00
authproxy.py Merge #19368: test: improve functional tests compatibility with BSD/macOS 2024-01-06 19:30:15 -06:00
blocktools.py fix: some fixes for block payee validation and corresponding tests (#5684) 2023-11-13 10:02:52 -06:00
coverage.py Merge bitcoin/bitcoin#22139: test: add type annotations to util.get_rpc_proxy 2023-12-03 20:13:09 -06:00
descriptors.py
key.py
messages.py Merge #19818: p2p: change CInv::type from int to uint32_t, fix UBSan warning 2024-01-22 19:44:37 -06:00
muhash.py
netutil.py
p2p.py Merge #19760: test: Remove confusing mininode terminology 2024-01-20 00:07:10 +07:00
ripemd160.py
script_util.py
script.py Merge #19674: refactor: test: use throwaway _ variable for unused loop counters 2024-01-20 00:07:09 +07:00
siphash.py
socks5.py
test_framework.py Merge #20159: test: mining_getblocktemplate_longpoll.py improvements (use MiniWallet, add logging) 2024-01-26 12:50:30 -06:00
test_node.py Merge #19804: test/refactor: reference p2p objects explicitly and remove confusing Test_Node.p2p property 2024-01-27 22:55:29 -06:00
test_shell.py
util.py Merge #20159: test: mining_getblocktemplate_longpoll.py improvements (use MiniWallet, add logging) 2024-01-26 12:50:30 -06:00
wallet_util.py Merge #17891: scripted-diff: Replace CCriticalSection with RecursiveMutex 2023-05-24 12:43:57 -05:00
wallet.py Merge #20385: test: run mempool_spend_coinbase.py even with wallet disabled 2024-01-26 12:50:32 -06:00