Skip to content

Commit

Permalink
Clean up imports to be pyflakes-checkable. fixes zcash#2450
Browse files Browse the repository at this point in the history
Signed-off-by: Daira Hopwood <[email protected]>
  • Loading branch information
daira committed Jun 22, 2017
1 parent d52ac0d commit aff0bf7
Show file tree
Hide file tree
Showing 50 changed files with 214 additions and 166 deletions.
4 changes: 3 additions & 1 deletion qa/rpc-tests/decodescript.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import assert_equal, initialize_chain_clean, \
start_nodes


class DecodeScriptTest(BitcoinTestFramework):
"""Tests decoding scripts via RPC command "decodescript"."""
Expand Down
3 changes: 2 additions & 1 deletion qa/rpc-tests/disablewallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import initialize_chain_clean, start_nodes


class DisableWalletTest (BitcoinTestFramework):

Expand Down
4 changes: 2 additions & 2 deletions qa/rpc-tests/forknotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import start_node, connect_nodes

import os
import shutil

class ForkNotifyTest(BitcoinTestFramework):

Expand Down
9 changes: 6 additions & 3 deletions qa/rpc-tests/fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from pprint import pprint
from time import sleep
from test_framework.authproxy import JSONRPCException
from test_framework.util import assert_equal, assert_greater_than, \
initialize_chain_clean, start_nodes, connect_nodes_bi, stop_nodes, \
wait_bitcoinds

from decimal import Decimal

# Create one-input, one-output, no-fee transaction:
class RawTransactionsTest(BitcoinTestFramework):
Expand Down
3 changes: 2 additions & 1 deletion qa/rpc-tests/getblocktemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import initialize_chain_clean, start_nodes, \
connect_nodes_bi


class GetBlockTemplateTest(BitcoinTestFramework):
Expand Down
4 changes: 3 additions & 1 deletion qa/rpc-tests/getblocktemplate_longpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.authproxy import AuthServiceProxy
from test_framework.util import random_transaction

from decimal import Decimal

def check_array_result(object_array, to_match, expected):
"""
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/getblocktemplate_proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.authproxy import JSONRPCException

from binascii import a2b_hex, b2a_hex
from hashlib import sha256
Expand Down
5 changes: 3 additions & 2 deletions qa/rpc-tests/hardforkdetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.authproxy import JSONRPCException
from test_framework.util import assert_equal, start_node

import os
import shutil

class HardForkDetectionTest(BitcoinTestFramework):

Expand Down
3 changes: 2 additions & 1 deletion qa/rpc-tests/httpbasics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import assert_equal, start_nodes

import base64

try:
Expand Down
5 changes: 4 additions & 1 deletion qa/rpc-tests/invalidateblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import initialize_chain_clean, start_node, \
connect_nodes_bi, sync_blocks

import time

class InvalidateTest(BitcoinTestFramework):

Expand Down
8 changes: 4 additions & 4 deletions qa/rpc-tests/invalidblockrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#

from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.util import assert_equal
from test_framework.comptool import TestManager, TestInstance
from test_framework.mininode import *
from test_framework.blocktools import *
import logging
from test_framework.mininode import NetworkThread
from test_framework.blocktools import create_block, create_coinbase, create_transaction

import copy
import time

Expand Down
11 changes: 5 additions & 6 deletions qa/rpc-tests/keypool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
# Exercise the wallet keypool, and interaction with wallet encryption/locking

# Add python-bitcoinrpc to module search path:

from test_framework.authproxy import JSONRPCException
from test_framework.util import check_json_precision, initialize_chain, \
start_nodes, start_node, stop_nodes, wait_bitcoinds, bitcoind_processes

import os
import sys

import json
import shutil
import subprocess
import tempfile
import traceback

from test_framework.util import *


def check_array_result(object_array, to_match, expected):
"""
Pass in array of JSON objects, a dictionary with key/value pairs
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/listtransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Exercise the listtransactions API

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *

from decimal import Decimal

def check_array_result(object_array, to_match, expected):
"""
Expand Down
10 changes: 8 additions & 2 deletions qa/rpc-tests/maxblocksinflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#

from test_framework.mininode import *
from test_framework.mininode import NodeConn, NodeConnCB, NetworkThread, \
EarlyDisconnectError, CInv, msg_inv, mininode_lock
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import initialize_chain_clean, start_nodes, \
p2p_port

import os
import time
import random
import logging

'''
Expand Down
5 changes: 2 additions & 3 deletions qa/rpc-tests/mempool_coinbase_spends.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import os
import shutil
from test_framework.util import assert_equal, start_node, connect_nodes


# Create one-input, one-output, no-fee transaction:
class MempoolCoinbaseTest(BitcoinTestFramework):
Expand Down
5 changes: 2 additions & 3 deletions qa/rpc-tests/mempool_resurrect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import os
import shutil
from test_framework.util import assert_equal, start_node


# Create one-input, one-output, no-fee transaction:
class MempoolCoinbaseTest(BitcoinTestFramework):
Expand Down
7 changes: 4 additions & 3 deletions qa/rpc-tests/mempool_spendcoinbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import os
import shutil
from test_framework.authproxy import JSONRPCException
from test_framework.util import assert_equal, assert_greater_than, assert_raises, \
start_node


# Create one-input, one-output, no-fee transaction:
class MempoolSpendCoinbaseTest(BitcoinTestFramework):
Expand Down
14 changes: 8 additions & 6 deletions qa/rpc-tests/mempool_tx_input_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import os
import shutil
from time import sleep
from test_framework.authproxy import JSONRPCException
from test_framework.util import assert_equal, initialize_chain_clean, \
start_node, connect_nodes

import time
from decimal import Decimal

# Test -mempooltxinputlimit
class MempoolTxInputLimitTest(BitcoinTestFramework):
Expand Down Expand Up @@ -44,7 +46,7 @@ def wait_and_assert_operationid_status(self, myopid, in_status='success', in_err
for x in xrange(1, timeout):
results = self.nodes[0].z_getoperationresult(opids)
if len(results)==0:
sleep(1)
time.sleep(1)
else:
status = results[0]["status"]
if status == "failed":
Expand Down Expand Up @@ -90,7 +92,7 @@ def run_test(self):
for x in xrange(1, timeout):
results = self.nodes[0].z_getoperationresult(opids)
if len(results)==0:
sleep(1)
time.sleep(1)
else:
status = results[0]["status"]
msg = results[0]["error"]["message"]
Expand Down
7 changes: 4 additions & 3 deletions qa/rpc-tests/merkle_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import os
import shutil
from test_framework.authproxy import JSONRPCException
from test_framework.util import assert_equal, assert_raises, \
initialize_chain_clean, start_node, connect_nodes


class MerkleBlockTest(BitcoinTestFramework):

Expand Down
9 changes: 3 additions & 6 deletions qa/rpc-tests/nodehandling.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import base64
from test_framework.util import assert_equal, connect_nodes_bi, p2p_port

import time

try:
import http.client as httplib
except ImportError:
import httplib
try:
import urllib.parse as urlparse
except ImportError:
Expand Down
11 changes: 8 additions & 3 deletions qa/rpc-tests/p2p-acceptblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#

from test_framework.mininode import *
from test_framework.mininode import CBlockHeader, CInv, NodeConn, NodeConnCB, \
NetworkThread, msg_block, msg_headers, msg_inv, msg_ping, msg_pong, \
mininode_lock
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
from test_framework.util import assert_equal, initialize_chain_clean, \
start_node, p2p_port
from test_framework.blocktools import create_block, create_coinbase

import os
import time

'''
AcceptBlockTest -- test processing of unrequested blocks.
Expand Down
9 changes: 5 additions & 4 deletions qa/rpc-tests/prioritisetransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from time import *
from test_framework.util import assert_equal, initialize_chain_clean, \
start_node, connect_nodes
from test_framework.mininode import COIN

import time


Expand Down Expand Up @@ -37,7 +38,7 @@ def wait_and_assert_operationid_status(self, myopid, in_status='success', in_err
for x in xrange(1, timeout):
results = self.nodes[0].z_getoperationresult(opids)
if len(results)==0:
sleep(1)
time.sleep(1)
else:
status = results[0]["status"]
if status == "failed":
Expand Down Expand Up @@ -120,7 +121,7 @@ def run_test (self):
break
if time.time() - start > 30:
raise AssertionError("Test timed out because prioritised transaction was not returned by getblocktemplate within 30 seconds.")
sleep(1)
time.sleep(1)
block_template = self.nodes[0].getblocktemplate()

assert(in_block_template)
Expand Down
16 changes: 4 additions & 12 deletions qa/rpc-tests/proton_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,13 @@
#

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import assert_equal, bytes_to_hex_str, \
start_nodes

from proton.handlers import MessagingHandler
from proton.reactor import Container
import binascii
import struct
import threading

try:
import http.client as httplib
except ImportError:
import httplib
try:
import urllib.parse as urlparse
except ImportError:
import urlparse
import threading


class Server(MessagingHandler):
Expand Down
10 changes: 5 additions & 5 deletions qa/rpc-tests/proxy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import socket
import traceback, sys
from binascii import hexlify
import time, os

from test_framework.socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.util import assert_equal, start_nodes

import socket
import os

'''
Test plan:
- Start bitcoind's with different proxy configurations
Expand Down
6 changes: 5 additions & 1 deletion qa/rpc-tests/pruning.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
# ********

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.authproxy import JSONRPCException
from test_framework.util import initialize_chain_clean, start_node, \
connect_nodes, stop_node, sync_blocks

import os.path
import time

def calc_usage(blockdir):
return sum(os.path.getsize(blockdir+f) for f in os.listdir(blockdir) if os.path.isfile(blockdir+f))/(1024*1024)
Expand Down
Loading

0 comments on commit aff0bf7

Please sign in to comment.