Skip to content

Commit 4edc689

Browse files
committed
doc: test: suggest multi-line imports in functional test style guide
1 parent c012875 commit 4edc689

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

test/functional/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ don't have test cases for.
2828
could lead to bugs and issues in the test code.
2929
- Use [type hints](https://docs.python.org/3/library/typing.html) in your code to improve code readability
3030
and to detect possible bugs earlier.
31-
- Avoid wildcard imports
31+
- Avoid wildcard imports.
32+
- If more than one name from a module is needed, use lexicographically sorted multi-line imports
33+
in order to reduce the possibility of potential merge conflicts.
3234
- Use a module-level docstring to describe what the test is testing, and how it
3335
is testing it.
3436
- When subclassing the BitcoinTestFramework, place overrides for the

test/functional/example_test.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@
1414
from collections import defaultdict
1515

1616
# Avoid wildcard * imports
17-
from test_framework.blocktools import (create_block, create_coinbase)
18-
from test_framework.messages import CInv, MSG_BLOCK
17+
# Use lexicographically sorted multi-line imports
18+
from test_framework.blocktools import (
19+
create_block,
20+
create_coinbase,
21+
)
22+
from test_framework.messages import (
23+
CInv,
24+
MSG_BLOCK,
25+
)
1926
from test_framework.p2p import (
2027
P2PInterface,
2128
msg_block,

0 commit comments

Comments
 (0)