Skip to content

Commit

Permalink
move chia.util.block_tools and chia.util.wallet_tools into tests (Chi…
Browse files Browse the repository at this point in the history
…a-Network#6799)

* move chia.util.block_tools and chia.util.wallet_tools into tests

* only depend on block_tools when we actually run the wallet in test mode
  • Loading branch information
arvidn authored Jun 16, 2021
1 parent 662286c commit 42fde9a
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 22 deletions.
3 changes: 2 additions & 1 deletion chia/server/start_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from chia.server.outbound_message import NodeType
from chia.server.start_service import run_service
from chia.types.peer_info import PeerInfo
from chia.util.block_tools import test_constants
from chia.util.config import load_config_cli, load_config
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.util.keychain import Keychain
Expand Down Expand Up @@ -81,6 +80,8 @@ def main() -> None:
# This is simulator
local_test = config["testing"]
if local_test is True:
from tests.block_tools import test_constants

constants = test_constants
current = config["database_path"]
config["database_path"] = f"{current}_simulation"
Expand Down
2 changes: 1 addition & 1 deletion chia/simulator/simulator_constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if __name__ == "__main__":
from chia.util.block_tools import BlockTools, test_constants
from tests.block_tools import BlockTools, test_constants
from chia.util.default_root import DEFAULT_ROOT_PATH

# TODO: mariano: fix this with new consensus
Expand Down
2 changes: 1 addition & 1 deletion chia/simulator/start_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from chia.rpc.full_node_rpc_api import FullNodeRpcApi
from chia.server.outbound_message import NodeType
from chia.server.start_service import run_service
from chia.util.block_tools import BlockTools, test_constants
from tests.block_tools import BlockTools, test_constants
from chia.util.config import load_config_cli
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.util.path import mkdir, path_from_root
Expand Down
2 changes: 1 addition & 1 deletion chia/util/block_tools.py → tests/block_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from chia.util.keychain import Keychain, bytes_to_mnemonic
from chia.util.path import mkdir
from chia.util.vdf_prover import get_vdf_info_and_proof
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from chia.wallet.derive_keys import (
master_sk_to_farmer_sk,
master_sk_to_local_sk,
Expand Down
4 changes: 2 additions & 2 deletions tests/blockchain/test_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
from chia.types.full_block import FullBlock
from chia.types.spend_bundle import SpendBundle
from chia.types.unfinished_block import UnfinishedBlock
from chia.util.block_tools import BlockTools, get_vdf_info_and_proof
from tests.block_tools import BlockTools, get_vdf_info_and_proof
from chia.util.errors import Err
from chia.util.hash import std_hash
from chia.util.ints import uint8, uint64, uint32
from chia.util.merkle_set import MerkleSet
from chia.util.recursive_replace import recursive_replace
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from tests.core.fixtures import default_400_blocks # noqa: F401; noqa: F401
from tests.core.fixtures import default_1000_blocks # noqa: F401
from tests.core.fixtures import default_10000_blocks # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion tests/blockchain/test_blockchain_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from chia.types.spend_bundle import SpendBundle
from chia.util.errors import ConsensusError, Err
from chia.util.ints import uint64
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from tests.core.full_node.test_full_node import connect_and_get_peer
from tests.setup_nodes import bt, setup_two_nodes, test_constants
from tests.util.generator_tools_testing import run_and_get_removals_and_additions
Expand Down
2 changes: 1 addition & 1 deletion tests/core/daemon/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from chia.server.outbound_message import NodeType
from chia.server.server import ssl_context_for_server
from chia.types.peer_info import PeerInfo
from chia.util.block_tools import BlockTools
from tests.block_tools import BlockTools
from chia.util.ints import uint16
from chia.util.ws_message import create_payload
from tests.core.node_height import node_height_at_least
Expand Down
2 changes: 1 addition & 1 deletion tests/core/full_node/test_coin_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from chia.types.generator_types import BlockGenerator
from chia.util.generator_tools import tx_removals_and_additions
from chia.util.ints import uint64, uint32
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from chia.util.db_wrapper import DBWrapper
from tests.setup_nodes import bt, test_constants

Expand Down
2 changes: 1 addition & 1 deletion tests/core/full_node/test_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from chia.types.condition_opcodes import ConditionOpcode
from chia.types.full_block import FullBlock
from chia.types.spend_bundle import SpendBundle
from chia.util.block_tools import BlockTools, test_constants
from tests.block_tools import BlockTools, test_constants
from chia.util.errors import Err

from .ram_db import create_ram_blockchain
Expand Down
4 changes: 2 additions & 2 deletions tests/core/full_node/test_full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
from chia.types.peer_info import PeerInfo, TimestampedPeerInfo
from chia.types.spend_bundle import SpendBundle
from chia.types.unfinished_block import UnfinishedBlock
from chia.util.block_tools import get_signage_point
from tests.block_tools import get_signage_point
from chia.util.clvm import int_to_bytes
from chia.util.errors import Err
from chia.util.hash import std_hash
from chia.util.ints import uint8, uint16, uint32, uint64
from chia.util.recursive_replace import recursive_replace
from chia.util.vdf_prover import get_vdf_info_and_proof
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from tests.core.fixtures import empty_blockchain # noqa: F401
from chia.wallet.cc_wallet.cc_wallet import CCWallet
from chia.wallet.transaction_record import TransactionRecord
Expand Down
2 changes: 1 addition & 1 deletion tests/core/full_node/test_full_node_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.unfinished_block import UnfinishedBlock
from chia.util.block_cache import BlockCache
from chia.util.block_tools import get_signage_point
from tests.block_tools import get_signage_point
from chia.util.hash import std_hash
from chia.util.ints import uint8, uint32, uint64, uint128
from tests.core.fixtures import default_1000_blocks, empty_blockchain # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion tests/core/full_node/test_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from chia.types.unfinished_block import UnfinishedBlock
from chia.util.clvm import int_to_bytes
from chia.util.ints import uint64
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from tests.core.fixtures import empty_blockchain # noqa: F401

from tests.connection_utils import add_dummy_connection, connect_and_get_peer
Expand Down
2 changes: 1 addition & 1 deletion tests/core/ssl/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from chia.server.ws_connection import WSChiaConnection
from chia.ssl.create_ssl import generate_ca_signed_cert
from chia.types.peer_info import PeerInfo
from chia.util.block_tools import test_constants
from tests.block_tools import test_constants
from chia.util.ints import uint16
from tests.setup_nodes import (
bt,
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_farmer_harvester_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from chia.rpc.rpc_server import start_rpc_server
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash
from chia.util.block_tools import get_plot_dir
from tests.block_tools import get_plot_dir
from chia.util.config import load_config
from chia.util.hash import std_hash
from chia.util.ints import uint8, uint16, uint32, uint64
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_full_node_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from chia.types.unfinished_block import UnfinishedBlock
from chia.util.hash import std_hash
from chia.util.ints import uint16
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from tests.setup_nodes import bt, self_hostname, setup_simulators_and_wallets, test_constants
from tests.time_out_assert import time_out_assert

Expand Down
2 changes: 1 addition & 1 deletion tests/setup_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from chia.timelord.timelord_launcher import kill_processes, spawn_process
from chia.types.peer_info import PeerInfo
from chia.util.bech32m import encode_puzzle_hash
from chia.util.block_tools import BlockTools, test_constants
from tests.block_tools import BlockTools, test_constants
from chia.util.hash import std_hash
from chia.util.ints import uint16, uint32
from chia.util.keychain import Keychain, bytes_to_mnemonic
Expand Down
2 changes: 1 addition & 1 deletion tests/simulation/test_simulation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from chia.types.peer_info import PeerInfo
from chia.util.block_tools import BlockTools
from tests.block_tools import BlockTools
from chia.util.ints import uint16
from tests.core.node_height import node_height_at_least
from tests.setup_nodes import self_hostname, setup_full_node, setup_full_system, test_constants
Expand Down
2 changes: 1 addition & 1 deletion tests/util/benchmark_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from chia.types.condition_opcodes import ConditionOpcode
from chia.types.condition_with_args import ConditionWithArgs
from chia.util.ints import uint32
from chia.util.wallet_tools import WalletTool
from tests.wallet_tools import WalletTool
from chia.wallet.derive_keys import master_sk_to_wallet_sk
from chia.wallet.puzzles.p2_delegated_puzzle import puzzle_for_pk

Expand Down
2 changes: 1 addition & 1 deletion tests/util/key_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from chia.types.coin_solution import CoinSolution
from chia.util.condition_tools import conditions_by_opcode, conditions_for_solution, pkm_pairs_for_conditions_dict
from tests.core.make_block_generator import GROUP_ORDER, int_to_public_key
from chia.util.block_tools import test_constants
from tests.block_tools import test_constants


class KeyTool(dict):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/weight_proof/test_weight_proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
from chia.util.block_cache import BlockCache
from chia.util.block_tools import test_constants
from tests.block_tools import test_constants
from chia.util.config import load_config
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.util.generator_tools import get_block_header
Expand Down

0 comments on commit 42fde9a

Please sign in to comment.