Skip to content

Commit 68400d8

Browse files
tests: Use explicit imports
1 parent 2115cba commit 68400d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+143
-94
lines changed

test/functional/feature_bip68_sequence.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test BIP68 implementation."""
66

7+
import time
8+
9+
from test_framework.blocktools import create_block, create_coinbase, add_witness_commitment
10+
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, FromHex, ToHex
11+
from test_framework.script import CScript
712
from test_framework.test_framework import BitcoinTestFramework
8-
from test_framework.util import *
9-
from test_framework.blocktools import *
13+
from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, bytes_to_hex_str, get_bip9_status, satoshi_round, sync_blocks
1014

1115
SEQUENCE_LOCKTIME_DISABLE_FLAG = (1<<31)
1216
SEQUENCE_LOCKTIME_TYPE_FLAG = (1<<22) # this means use time (0 means height)

test/functional/feature_cltv.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
1351.
99
"""
1010

11-
from test_framework.test_framework import BitcoinTestFramework
12-
from test_framework.util import *
13-
from test_framework.mininode import *
1411
from test_framework.blocktools import create_coinbase, create_block, create_transaction
12+
from test_framework.messages import CTransaction, msg_block, ToHex
13+
from test_framework.mininode import mininode_lock, P2PInterface
1514
from test_framework.script import CScript, OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP, CScriptNum
15+
from test_framework.test_framework import BitcoinTestFramework
16+
from test_framework.util import assert_equal, bytes_to_hex_str, hex_str_to_bytes, wait_until
17+
1618
from io import BytesIO
1719

1820
CLTV_HEIGHT = 1351

test/functional/feature_dbcrash.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@
3131
import sys
3232
import time
3333

34-
from test_framework.mininode import *
35-
from test_framework.script import *
34+
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, ToHex
3635
from test_framework.test_framework import BitcoinTestFramework
37-
from test_framework.util import *
36+
from test_framework.util import assert_equal, create_confirmed_utxos, hex_str_to_bytes
3837

3938
HTTP_DISCONNECT_ERRORS = [http.client.CannotSendRequest]
4039
try:

test/functional/feature_dersig.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
Test that the DERSIG soft-fork activates at (regtest) height 1251.
88
"""
99

10-
from test_framework.test_framework import BitcoinTestFramework
11-
from test_framework.util import *
12-
from test_framework.mininode import *
1310
from test_framework.blocktools import create_coinbase, create_block, create_transaction
11+
from test_framework.messages import msg_block
12+
from test_framework.mininode import mininode_lock, P2PInterface
1413
from test_framework.script import CScript
14+
from test_framework.test_framework import BitcoinTestFramework
15+
from test_framework.util import assert_equal, bytes_to_hex_str, wait_until
1516

1617
DERSIG_HEIGHT = 1251
1718

test/functional/feature_fee_estimation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from decimal import Decimal
77
import random
88

9-
from test_framework.mininode import CTransaction, CTxIn, CTxOut, COutPoint, ToHex, COIN
9+
from test_framework.messages import CTransaction, CTxIn, CTxOut, COutPoint, ToHex, COIN
1010
from test_framework.script import CScript, OP_1, OP_DROP, OP_2, OP_HASH160, OP_EQUAL, hash160, OP_TRUE
1111
from test_framework.test_framework import BitcoinTestFramework
1212
from test_framework.util import (

test/functional/feature_maxuploadtarget.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
from collections import defaultdict
1414
import time
1515

16-
from test_framework.mininode import *
16+
from test_framework.messages import CInv, msg_getdata
17+
from test_framework.mininode import P2PInterface
1718
from test_framework.test_framework import BitcoinTestFramework
18-
from test_framework.util import *
19+
from test_framework.util import assert_equal, mine_large_block
1920

2021
class TestP2PConn(P2PInterface):
2122
def __init__(self):

test/functional/feature_nulldummy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
[Policy/Consensus] Check that the new NULLDUMMY rules are enforced on the 432nd block.
1414
"""
1515

16-
from test_framework.test_framework import BitcoinTestFramework
17-
from test_framework.util import *
18-
from test_framework.messages import CTransaction
1916
from test_framework.blocktools import create_coinbase, create_block, create_transaction, add_witness_commitment
17+
from test_framework.messages import CTransaction
2018
from test_framework.script import CScript
19+
from test_framework.test_framework import BitcoinTestFramework
20+
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str
21+
2122
import time
2223

2324
NULLDUMMY_ERROR = "non-mandatory-script-verify-flag (Dummy CHECKMULTISIG argument must be zero) (code 64)"

test/functional/feature_pruning.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"""
1111

1212
from test_framework.test_framework import BitcoinTestFramework
13-
from test_framework.util import *
13+
from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, connect_nodes, mine_large_block, sync_blocks, wait_until
14+
1415
import os
1516

1617
MIN_BLOCKS_TO_KEEP = 288

test/functional/feature_rbf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test the RBF code."""
66

7+
from decimal import Decimal
8+
9+
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut
10+
from test_framework.script import CScript, OP_DROP
711
from test_framework.test_framework import BitcoinTestFramework
8-
from test_framework.util import *
9-
from test_framework.script import *
10-
from test_framework.mininode import *
12+
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str, satoshi_round
1113

1214
MAX_REPLACEMENT_LIMIT = 100
1315

test/functional/feature_segwit.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test the SegWit changeover logic."""
66

7+
from decimal import Decimal
8+
79
from test_framework.address import (
10+
key_to_p2pkh,
811
key_to_p2sh_p2wpkh,
912
key_to_p2wpkh,
1013
program_to_witness,
14+
script_to_p2sh,
1115
script_to_p2sh_p2wsh,
1216
script_to_p2wsh,
1317
)
1418
from test_framework.blocktools import witness_script, send_to_witness
15-
from test_framework.test_framework import BitcoinTestFramework
16-
from test_framework.util import *
17-
from test_framework.mininode import sha256, CTransaction, CTxIn, COutPoint, CTxOut, COIN, ToHex, FromHex
18-
from test_framework.address import script_to_p2sh, key_to_p2pkh
19+
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, FromHex, sha256, ToHex
1920
from test_framework.script import CScript, OP_HASH160, OP_CHECKSIG, OP_0, hash160, OP_EQUAL, OP_DUP, OP_EQUALVERIFY, OP_1, OP_2, OP_CHECKMULTISIG, OP_TRUE, OP_DROP
21+
from test_framework.test_framework import BitcoinTestFramework
22+
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str, connect_nodes, hex_str_to_bytes, sync_blocks, try_rpc
23+
2024
from io import BytesIO
2125

2226
NODE_0 = 0

0 commit comments

Comments
 (0)