mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge bitcoin/bitcoin#25811: doc: test: suggest multi-line imports in functional test style guide
4edc6893825fd8c45c53c81c73a6a7801e1b458c doc: test: suggest multi-line imports in functional test style guide (Sebastian Falbesoner) Pull request description: As long as I remember contributing to functional tests (~2-3 years), it was always kind of an unwritten rule that multi-line imports are preferred over single-line imports in order to reduce the possibility of potential merge conflicts -- at least if more than one symbol from a module is imported. This PR adds this rule to the style guide and adapts the example test accordingly. (Inspired by https://github.com/bitcoin/bitcoin/pull/25792#discussion_r941180819). ACKs for top commit: kouloumos: ACK 4edc6893825fd8c45c53c81c73a6a7801e1b458c 1440000bytes: ACK4edc689382
w0xlt: ACK4edc689382
fanquake: ACK 4edc6893825fd8c45c53c81c73a6a7801e1b458c Tree-SHA512: c7b6ff62f601f4e57cc8334d291662987d6737ebca8d81c063280409f4412302172f1404ec16afc9a13007bcdba55bdab66b9b80363287e287888929cb386584
This commit is contained in:
parent
3e693ddfb5
commit
afc1a9f4ac
@ -28,7 +28,9 @@ don't have test cases for.
|
||||
could lead to bugs and issues in the test code.
|
||||
- Use [type hints](https://docs.python.org/3/library/typing.html) in your code to improve code readability
|
||||
and to detect possible bugs earlier.
|
||||
- Avoid wildcard imports
|
||||
- Avoid wildcard imports.
|
||||
- If more than one name from a module is needed, use lexicographically sorted multi-line imports
|
||||
in order to reduce the possibility of potential merge conflicts.
|
||||
- Use a module-level docstring to describe what the test is testing, and how it
|
||||
is testing it.
|
||||
- When subclassing the BitcoinTestFramework, place overrides for the
|
||||
|
@ -14,8 +14,15 @@ is testing and *how* it's being tested
|
||||
from collections import defaultdict
|
||||
|
||||
# Avoid wildcard * imports
|
||||
from test_framework.blocktools import (create_block, create_coinbase)
|
||||
from test_framework.messages import CInv, MSG_BLOCK
|
||||
# Use lexicographically sorted multi-line imports
|
||||
from test_framework.blocktools import (
|
||||
create_block,
|
||||
create_coinbase,
|
||||
)
|
||||
from test_framework.messages import (
|
||||
CInv,
|
||||
MSG_BLOCK,
|
||||
)
|
||||
from test_framework.p2p import (
|
||||
P2PInterface,
|
||||
msg_block,
|
||||
|
Loading…
Reference in New Issue
Block a user