diff --git a/benchmarks/block_store.py b/benchmarks/block_store.py index 3bce4bef7266..b93d6252dda9 100644 --- a/benchmarks/block_store.py +++ b/benchmarks/block_store.py @@ -9,6 +9,17 @@ from typing import List from benchmarks.utils import setup_db +from chia._tests.util.benchmarks import ( + clvm_generator, + rand_bytes, + rand_class_group_element, + rand_g1, + rand_g2, + rand_hash, + rand_vdf, + rand_vdf_proof, + rewards, +) from chia.consensus.block_record import BlockRecord from chia.full_node.block_store import BlockStore from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo @@ -20,17 +31,6 @@ from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary from chia.types.full_block import FullBlock from chia.util.ints import uint8, uint32, uint64, uint128 -from tests.util.benchmarks import ( - clvm_generator, - rand_bytes, - rand_class_group_element, - rand_g1, - rand_g2, - rand_hash, - rand_vdf, - rand_vdf_proof, - rewards, -) # to run this benchmark: # python -m benchmarks.coin_store diff --git a/benchmarks/coin_store.py b/benchmarks/coin_store.py index 86e37f00d4db..5b31ff92feb0 100644 --- a/benchmarks/coin_store.py +++ b/benchmarks/coin_store.py @@ -9,11 +9,11 @@ from typing import List, Tuple from benchmarks.utils import setup_db +from chia._tests.util.benchmarks import rand_hash, rewards from chia.full_node.coin_store import CoinStore from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint32, uint64 -from tests.util.benchmarks import rand_hash, rewards # to run this benchmark: # python -m benchmarks.coin_store diff --git a/benchmarks/streamable.py b/benchmarks/streamable.py index b46fa1812493..5af06d7fb4c7 100644 --- a/benchmarks/streamable.py +++ b/benchmarks/streamable.py @@ -11,11 +11,11 @@ import click from benchmarks.utils import EnumType, get_commit_hash +from chia._tests.util.benchmarks import rand_bytes, rand_full_block, rand_hash from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.full_block import FullBlock from chia.util.ints import uint8, uint64 from chia.util.streamable import Streamable, streamable -from tests.util.benchmarks import rand_bytes, rand_full_block, rand_hash # to run this benchmark: # python -m benchmarks.streamable diff --git a/tests/README.md b/chia/_tests/README.md similarity index 100% rename from tests/README.md rename to chia/_tests/README.md diff --git a/tests/__init__.py b/chia/_tests/__init__.py similarity index 100% rename from tests/__init__.py rename to chia/_tests/__init__.py diff --git a/tests/blockchain/__init__.py b/chia/_tests/blockchain/__init__.py similarity index 100% rename from tests/blockchain/__init__.py rename to chia/_tests/blockchain/__init__.py diff --git a/tests/blockchain/blockchain_test_utils.py b/chia/_tests/blockchain/blockchain_test_utils.py similarity index 100% rename from tests/blockchain/blockchain_test_utils.py rename to chia/_tests/blockchain/blockchain_test_utils.py diff --git a/tests/blockchain/config.py b/chia/_tests/blockchain/config.py similarity index 100% rename from tests/blockchain/config.py rename to chia/_tests/blockchain/config.py diff --git a/tests/blockchain/test_blockchain.py b/chia/_tests/blockchain/test_blockchain.py similarity index 99% rename from tests/blockchain/test_blockchain.py rename to chia/_tests/blockchain/test_blockchain.py index 0e4c7179a487..3a26c5a0ed78 100644 --- a/tests/blockchain/test_blockchain.py +++ b/chia/_tests/blockchain/test_blockchain.py @@ -13,6 +13,15 @@ from chia_rs import AugSchemeMPL, G2Element from clvm.casts import int_to_bytes +from chia._tests.blockchain.blockchain_test_utils import ( + _validate_and_add_block, + _validate_and_add_block_multi_error, + _validate_and_add_block_multi_result, + _validate_and_add_block_no_error, + check_block_store_invariant, +) +from chia._tests.conftest import ConsensusMode +from chia._tests.util.blockchain import create_blockchain from chia.consensus.block_body_validation import ForkInfo from chia.consensus.block_header_validation import validate_finished_header_block from chia.consensus.block_rewards import calculate_base_farmer_reward @@ -51,15 +60,6 @@ DEFAULT_HIDDEN_PUZZLE_HASH, calculate_synthetic_secret_key, ) -from tests.blockchain.blockchain_test_utils import ( - _validate_and_add_block, - _validate_and_add_block_multi_error, - _validate_and_add_block_multi_result, - _validate_and_add_block_no_error, - check_block_store_invariant, -) -from tests.conftest import ConsensusMode -from tests.util.blockchain import create_blockchain log = logging.getLogger(__name__) bad_element = ClassgroupElement.create(b"\x00") diff --git a/tests/blockchain/test_blockchain_transactions.py b/chia/_tests/blockchain/test_blockchain_transactions.py similarity index 99% rename from tests/blockchain/test_blockchain_transactions.py rename to chia/_tests/blockchain/test_blockchain_transactions.py index 5ac1f987e132..26089c19280b 100644 --- a/tests/blockchain/test_blockchain_transactions.py +++ b/chia/_tests/blockchain/test_blockchain_transactions.py @@ -6,6 +6,8 @@ import pytest from clvm.casts import int_to_bytes +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block +from chia._tests.util.generator_tools_testing import run_and_get_removals_and_additions from chia.full_node.full_node_api import FullNodeAPI from chia.protocols import wallet_protocol from chia.server.server import ChiaServer @@ -18,8 +20,6 @@ from chia.types.spend_bundle import SpendBundle, estimate_fees from chia.util.errors import ConsensusError, Err from chia.util.ints import uint32, uint64 -from tests.blockchain.blockchain_test_utils import _validate_and_add_block -from tests.util.generator_tools_testing import run_and_get_removals_and_additions BURN_PUZZLE_HASH = bytes32(b"0" * 32) diff --git a/tests/blockchain/test_lookup_fork_chain.py b/chia/_tests/blockchain/test_lookup_fork_chain.py similarity index 99% rename from tests/blockchain/test_lookup_fork_chain.py rename to chia/_tests/blockchain/test_lookup_fork_chain.py index e5db927e8d8f..f20071c0ab1e 100644 --- a/tests/blockchain/test_lookup_fork_chain.py +++ b/chia/_tests/blockchain/test_lookup_fork_chain.py @@ -5,12 +5,12 @@ import pytest +from chia._tests.util.benchmarks import rand_hash from chia.consensus.block_record import BlockRecord from chia.consensus.blockchain_interface import BlockchainInterface from chia.consensus.find_fork_point import find_fork_point_in_chain, lookup_fork_chain from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint32 -from tests.util.benchmarks import rand_hash class DummyChain: diff --git a/tests/build-init-files.py b/chia/_tests/build-init-files.py similarity index 100% rename from tests/build-init-files.py rename to chia/_tests/build-init-files.py diff --git a/tests/build-job-matrix.py b/chia/_tests/build-job-matrix.py similarity index 100% rename from tests/build-job-matrix.py rename to chia/_tests/build-job-matrix.py diff --git a/tests/check_pytest_monitor_output.py b/chia/_tests/check_pytest_monitor_output.py similarity index 100% rename from tests/check_pytest_monitor_output.py rename to chia/_tests/check_pytest_monitor_output.py diff --git a/tests/check_sql_statements.py b/chia/_tests/check_sql_statements.py similarity index 100% rename from tests/check_sql_statements.py rename to chia/_tests/check_sql_statements.py diff --git a/tests/chia-start-sim b/chia/_tests/chia-start-sim similarity index 100% rename from tests/chia-start-sim rename to chia/_tests/chia-start-sim diff --git a/tests/clvm/__init__.py b/chia/_tests/clvm/__init__.py similarity index 100% rename from tests/clvm/__init__.py rename to chia/_tests/clvm/__init__.py diff --git a/tests/clvm/benchmark_costs.py b/chia/_tests/clvm/benchmark_costs.py similarity index 100% rename from tests/clvm/benchmark_costs.py rename to chia/_tests/clvm/benchmark_costs.py diff --git a/tests/clvm/coin_store.py b/chia/_tests/clvm/coin_store.py similarity index 100% rename from tests/clvm/coin_store.py rename to chia/_tests/clvm/coin_store.py diff --git a/tests/clvm/test_chialisp_deserialization.py b/chia/_tests/clvm/test_chialisp_deserialization.py similarity index 100% rename from tests/clvm/test_chialisp_deserialization.py rename to chia/_tests/clvm/test_chialisp_deserialization.py diff --git a/tests/clvm/test_clvm_step.py b/chia/_tests/clvm/test_clvm_step.py similarity index 100% rename from tests/clvm/test_clvm_step.py rename to chia/_tests/clvm/test_clvm_step.py diff --git a/tests/clvm/test_condition_codes.py b/chia/_tests/clvm/test_condition_codes.py similarity index 100% rename from tests/clvm/test_condition_codes.py rename to chia/_tests/clvm/test_condition_codes.py diff --git a/tests/clvm/test_curry_and_treehash.py b/chia/_tests/clvm/test_curry_and_treehash.py similarity index 100% rename from tests/clvm/test_curry_and_treehash.py rename to chia/_tests/clvm/test_curry_and_treehash.py diff --git a/tests/clvm/test_program.py b/chia/_tests/clvm/test_program.py similarity index 100% rename from tests/clvm/test_program.py rename to chia/_tests/clvm/test_program.py diff --git a/tests/clvm/test_puzzle_compression.py b/chia/_tests/clvm/test_puzzle_compression.py similarity index 100% rename from tests/clvm/test_puzzle_compression.py rename to chia/_tests/clvm/test_puzzle_compression.py diff --git a/tests/clvm/test_puzzle_drivers.py b/chia/_tests/clvm/test_puzzle_drivers.py similarity index 100% rename from tests/clvm/test_puzzle_drivers.py rename to chia/_tests/clvm/test_puzzle_drivers.py diff --git a/tests/clvm/test_puzzles.py b/chia/_tests/clvm/test_puzzles.py similarity index 99% rename from tests/clvm/test_puzzles.py rename to chia/_tests/clvm/test_puzzles.py index 42404576777c..58a2ee93a64a 100644 --- a/tests/clvm/test_puzzles.py +++ b/chia/_tests/clvm/test_puzzles.py @@ -4,6 +4,7 @@ from chia_rs import AugSchemeMPL, G1Element, G2Element +from chia._tests.util.key_tool import KeyTool from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.program import Program from chia.types.blockchain_format.sized_bytes import bytes32 @@ -20,7 +21,6 @@ p2_puzzle_hash, ) from chia.wallet.puzzles.puzzle_utils import make_create_coin_condition -from tests.util.key_tool import KeyTool from ..core.make_block_generator import int_to_public_key from .coin_store import CoinStore, CoinTimestamp diff --git a/tests/clvm/test_singletons.py b/chia/_tests/clvm/test_singletons.py similarity index 99% rename from tests/clvm/test_singletons.py rename to chia/_tests/clvm/test_singletons.py index 8222bf1ad0d8..08e823b3b570 100644 --- a/tests/clvm/test_singletons.py +++ b/chia/_tests/clvm/test_singletons.py @@ -5,6 +5,8 @@ import pytest from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey +from chia._tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index +from chia._tests.util.key_tool import KeyTool from chia.clvm.spend_sim import CostLogger, SimClient, SpendSim, sim_and_client from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.coin import Coin @@ -17,8 +19,6 @@ from chia.util.ints import uint64 from chia.wallet.lineage_proof import LineageProof from chia.wallet.puzzles import p2_conditions, p2_delegated_puzzle_or_hidden_puzzle -from tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index -from tests.util.key_tool import KeyTool """ This test suite aims to test: diff --git a/tests/clvm/test_spend_sim.py b/chia/_tests/clvm/test_spend_sim.py similarity index 100% rename from tests/clvm/test_spend_sim.py rename to chia/_tests/clvm/test_spend_sim.py diff --git a/tests/cmds/__init__.py b/chia/_tests/cmds/__init__.py similarity index 100% rename from tests/cmds/__init__.py rename to chia/_tests/cmds/__init__.py diff --git a/tests/cmds/cmd_test_utils.py b/chia/_tests/cmds/cmd_test_utils.py similarity index 99% rename from tests/cmds/cmd_test_utils.py rename to chia/_tests/cmds/cmd_test_utils.py index c21c9f415b74..ddef40c7dc17 100644 --- a/tests/cmds/cmd_test_utils.py +++ b/chia/_tests/cmds/cmd_test_utils.py @@ -9,6 +9,7 @@ from chia_rs import Coin, G2Element import chia.cmds.wallet_funcs +from chia._tests.cmds.testing_classes import create_test_block_record from chia.cmds.chia import cli as chia_cli from chia.cmds.cmds_util import _T_RpcClient, node_config_section_names from chia.consensus.block_record import BlockRecord @@ -33,7 +34,6 @@ from chia.wallet.util.transaction_type import TransactionType from chia.wallet.util.tx_config import CoinSelectionConfig, TXConfig from chia.wallet.util.wallet_types import WalletType -from tests.cmds.testing_classes import create_test_block_record # Any functions that are the same for every command being tested should be below. # Functions that are specific to a command should be in the test file for that command. diff --git a/tests/cmds/config.py b/chia/_tests/cmds/config.py similarity index 100% rename from tests/cmds/config.py rename to chia/_tests/cmds/config.py diff --git a/tests/cmds/conftest.py b/chia/_tests/cmds/conftest.py similarity index 89% rename from tests/cmds/conftest.py rename to chia/_tests/cmds/conftest.py index 8378cd732611..881abcd85be8 100644 --- a/tests/cmds/conftest.py +++ b/chia/_tests/cmds/conftest.py @@ -6,8 +6,8 @@ import pytest +from chia._tests.cmds.cmd_test_utils import TestRpcClients, create_service_and_wallet_client_generators from chia.util.config import create_default_chia_config -from tests.cmds.cmd_test_utils import TestRpcClients, create_service_and_wallet_client_generators @pytest.fixture(scope="module") # every file has its own config generated, just to be safe diff --git a/tests/cmds/test_farm_cmd.py b/chia/_tests/cmds/test_farm_cmd.py similarity index 97% rename from tests/cmds/test_farm_cmd.py rename to chia/_tests/cmds/test_farm_cmd.py index e0283525cbef..f81414d4f534 100644 --- a/tests/cmds/test_farm_cmd.py +++ b/chia/_tests/cmds/test_farm_cmd.py @@ -6,12 +6,12 @@ import pytest from _pytest.capture import CaptureFixture +from chia._tests.util.time_out_assert import time_out_assert from chia.cmds.farm_funcs import summary from chia.farmer.farmer import Farmer from chia.harvester.harvester import Harvester from chia.simulator.block_tools import BlockTools from chia.types.aliases import FarmerService, HarvesterService, SimulatorFullNodeService, WalletService -from tests.util.time_out_assert import time_out_assert @pytest.mark.anyio diff --git a/tests/cmds/test_show.py b/chia/_tests/cmds/test_show.py similarity index 93% rename from tests/cmds/test_show.py rename to chia/_tests/cmds/test_show.py index 54d1bdfc8f10..f5083bfb1731 100644 --- a/tests/cmds/test_show.py +++ b/chia/_tests/cmds/test_show.py @@ -4,14 +4,14 @@ from pathlib import Path from typing import Any, Dict, List, Optional, Tuple +from chia._tests.cmds.cmd_test_utils import TestFullNodeRpcClient, TestRpcClients, run_cli_command_and_assert +from chia._tests.cmds.testing_classes import hash_to_height, height_hash +from chia._tests.util.test_full_block_utils import get_foliage, get_reward_chain_block, get_transactions_info, vdf_proof from chia.types.blockchain_format.foliage import FoliageTransactionBlock from chia.types.blockchain_format.serialized_program import SerializedProgram from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.full_block import FullBlock from chia.util.ints import uint32, uint64 -from tests.cmds.cmd_test_utils import TestFullNodeRpcClient, TestRpcClients, run_cli_command_and_assert -from tests.cmds.testing_classes import hash_to_height, height_hash -from tests.util.test_full_block_utils import get_foliage, get_reward_chain_block, get_transactions_info, vdf_proof @dataclass diff --git a/tests/cmds/test_sim.py b/chia/_tests/cmds/test_sim.py similarity index 100% rename from tests/cmds/test_sim.py rename to chia/_tests/cmds/test_sim.py diff --git a/tests/cmds/test_timelock_args.py b/chia/_tests/cmds/test_timelock_args.py similarity index 100% rename from tests/cmds/test_timelock_args.py rename to chia/_tests/cmds/test_timelock_args.py diff --git a/tests/cmds/test_tx_config_args.py b/chia/_tests/cmds/test_tx_config_args.py similarity index 100% rename from tests/cmds/test_tx_config_args.py rename to chia/_tests/cmds/test_tx_config_args.py diff --git a/tests/cmds/testing_classes.py b/chia/_tests/cmds/testing_classes.py similarity index 100% rename from tests/cmds/testing_classes.py rename to chia/_tests/cmds/testing_classes.py diff --git a/tests/cmds/wallet/__init__.py b/chia/_tests/cmds/wallet/__init__.py similarity index 100% rename from tests/cmds/wallet/__init__.py rename to chia/_tests/cmds/wallet/__init__.py diff --git a/tests/cmds/wallet/test_coins.py b/chia/_tests/cmds/wallet/test_coins.py similarity index 97% rename from tests/cmds/wallet/test_coins.py rename to chia/_tests/cmds/wallet/test_coins.py index a765b492642c..ad2c1ae35ea7 100644 --- a/tests/cmds/wallet/test_coins.py +++ b/chia/_tests/cmds/wallet/test_coins.py @@ -5,12 +5,12 @@ from chia_rs import Coin +from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert +from chia._tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32 from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.coin_record import CoinRecord from chia.util.ints import uint32, uint64 from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, CoinSelectionConfig, TXConfig -from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert -from tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32 # Coin Commands diff --git a/tests/cmds/wallet/test_consts.py b/chia/_tests/cmds/wallet/test_consts.py similarity index 100% rename from tests/cmds/wallet/test_consts.py rename to chia/_tests/cmds/wallet/test_consts.py diff --git a/tests/cmds/wallet/test_dao.py b/chia/_tests/cmds/wallet/test_dao.py similarity index 99% rename from tests/cmds/wallet/test_dao.py rename to chia/_tests/cmds/wallet/test_dao.py index 4b2a5e6546c1..d06751c592be 100644 --- a/tests/cmds/wallet/test_dao.py +++ b/chia/_tests/cmds/wallet/test_dao.py @@ -7,6 +7,8 @@ import pytest +from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, run_cli_command_and_assert +from chia._tests.cmds.wallet.test_consts import FINGERPRINT_ARG from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.bech32m import encode_puzzle_hash from chia.util.ints import uint8, uint32, uint64 @@ -15,8 +17,6 @@ from chia.wallet.util.transaction_type import TransactionType from chia.wallet.util.tx_config import TXConfig from chia.wallet.util.wallet_types import WalletType -from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, run_cli_command_and_assert -from tests.cmds.wallet.test_consts import FINGERPRINT_ARG # DAO Commands diff --git a/tests/cmds/wallet/test_did.py b/chia/_tests/cmds/wallet/test_did.py similarity index 98% rename from tests/cmds/wallet/test_did.py rename to chia/_tests/cmds/wallet/test_did.py index 4a31381335bc..c015086e19ec 100644 --- a/tests/cmds/wallet/test_did.py +++ b/chia/_tests/cmds/wallet/test_did.py @@ -3,12 +3,12 @@ from pathlib import Path from typing import Dict, List, Optional, Tuple, Union +from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert +from chia._tests.cmds.wallet.test_consts import FINGERPRINT_ARG, get_bytes32 from chia.types.blockchain_format.sized_bytes import bytes48 from chia.types.signing_mode import SigningMode from chia.util.bech32m import encode_puzzle_hash from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig -from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert -from tests.cmds.wallet.test_consts import FINGERPRINT_ARG, get_bytes32 # DID Commands diff --git a/tests/cmds/wallet/test_nft.py b/chia/_tests/cmds/wallet/test_nft.py similarity index 98% rename from tests/cmds/wallet/test_nft.py rename to chia/_tests/cmds/wallet/test_nft.py index 9544d124fa8b..1482dee3cbf3 100644 --- a/tests/cmds/wallet/test_nft.py +++ b/chia/_tests/cmds/wallet/test_nft.py @@ -3,14 +3,14 @@ from pathlib import Path from typing import Any, List, Optional, Tuple +from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert +from chia._tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32 from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.signing_mode import SigningMode from chia.util.bech32m import encode_puzzle_hash from chia.util.ints import uint8, uint16, uint32, uint64 from chia.wallet.nft_wallet.nft_info import NFTInfo from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig -from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert -from tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32 # NFT Commands diff --git a/tests/cmds/wallet/test_notifications.py b/chia/_tests/cmds/wallet/test_notifications.py similarity index 95% rename from tests/cmds/wallet/test_notifications.py rename to chia/_tests/cmds/wallet/test_notifications.py index b39fcbbbeb5d..2fa342555d20 100644 --- a/tests/cmds/wallet/test_notifications.py +++ b/chia/_tests/cmds/wallet/test_notifications.py @@ -3,13 +3,13 @@ from pathlib import Path from typing import List, Optional, Tuple, cast +from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert +from chia._tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32 from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.bech32m import encode_puzzle_hash from chia.util.ints import uint32, uint64 from chia.wallet.notification_store import Notification from chia.wallet.transaction_record import TransactionRecord -from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert -from tests.cmds.wallet.test_consts import FINGERPRINT, FINGERPRINT_ARG, get_bytes32 # Notifications Commands diff --git a/tests/cmds/wallet/test_offer.toffer b/chia/_tests/cmds/wallet/test_offer.toffer similarity index 100% rename from tests/cmds/wallet/test_offer.toffer rename to chia/_tests/cmds/wallet/test_offer.toffer diff --git a/tests/cmds/wallet/test_vcs.py b/chia/_tests/cmds/wallet/test_vcs.py similarity index 98% rename from tests/cmds/wallet/test_vcs.py rename to chia/_tests/cmds/wallet/test_vcs.py index ef21c7bd81d8..85374addd26c 100644 --- a/tests/cmds/wallet/test_vcs.py +++ b/chia/_tests/cmds/wallet/test_vcs.py @@ -5,14 +5,14 @@ from chia_rs import Coin +from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert +from chia._tests.cmds.wallet.test_consts import FINGERPRINT_ARG, STD_TX, get_bytes32 from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.bech32m import encode_puzzle_hash from chia.util.ints import uint32, uint64 from chia.wallet.transaction_record import TransactionRecord from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig from chia.wallet.vc_wallet.vc_store import VCRecord -from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert -from tests.cmds.wallet.test_consts import FINGERPRINT_ARG, STD_TX, get_bytes32 # VC Commands diff --git a/tests/cmds/wallet/test_wallet.py b/chia/_tests/cmds/wallet/test_wallet.py similarity index 99% rename from tests/cmds/wallet/test_wallet.py rename to chia/_tests/cmds/wallet/test_wallet.py index 0e497328c6d0..91d41c13605e 100644 --- a/tests/cmds/wallet/test_wallet.py +++ b/chia/_tests/cmds/wallet/test_wallet.py @@ -6,6 +6,17 @@ import pkg_resources from chia_rs import Coin, G2Element +from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert +from chia._tests.cmds.wallet.test_consts import ( + CAT_FINGERPRINT_ARG, + FINGERPRINT, + FINGERPRINT_ARG, + STD_TX, + WALLET_ID, + WALLET_ID_ARG, + bytes32_hexstr, + get_bytes32, +) from chia.server.outbound_message import NodeType from chia.types.blockchain_format.program import Program from chia.types.blockchain_format.sized_bytes import bytes32 @@ -24,17 +35,6 @@ from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet_coin_store import GetCoinRecords -from tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert -from tests.cmds.wallet.test_consts import ( - CAT_FINGERPRINT_ARG, - FINGERPRINT, - FINGERPRINT_ARG, - STD_TX, - WALLET_ID, - WALLET_ID_ARG, - bytes32_hexstr, - get_bytes32, -) test_offer_file_path: Path = Path(pkg_resources.resource_filename(__name__, "test_offer.toffer")) test_offer_file_name: str = str(test_offer_file_path) diff --git a/tests/cmds/wallet/test_wallet_check.py b/chia/_tests/cmds/wallet/test_wallet_check.py similarity index 100% rename from tests/cmds/wallet/test_wallet_check.py rename to chia/_tests/cmds/wallet/test_wallet_check.py diff --git a/tests/conftest.py b/chia/_tests/conftest.py similarity index 97% rename from tests/conftest.py rename to chia/_tests/conftest.py index 7f8c724dcff8..ab7d7d9bed24 100644 --- a/tests/conftest.py +++ b/chia/_tests/conftest.py @@ -20,6 +20,20 @@ # TODO: update after resolution in https://github.com/pytest-dev/pytest/issues/7469 from _pytest.fixtures import SubRequest +from chia._tests.core.data_layer.util import ChiaRoot +from chia._tests.core.node_height import node_height_at_least +from chia._tests.simulation.test_simulation import test_constants_modified +from chia._tests.util.misc import BenchmarkRunner, GcMode, _AssertRuntime, measure_overhead +from chia._tests.util.setup_nodes import ( + OldSimulatorsAndWallets, + SimulatorsAndWallets, + setup_full_system, + setup_n_nodes, + setup_simulators_and_wallets, + setup_simulators_and_wallets_service, + setup_two_nodes, +) +from chia._tests.util.time_out_assert import time_out_assert from chia.clvm.spend_sim import CostLogger from chia.consensus.constants import ConsensusConstants from chia.full_node.full_node import FullNode @@ -58,29 +72,15 @@ from chia.util.task_timing import start_task_instrumentation, stop_task_instrumentation from chia.wallet.wallet_node import WalletNode from chia.wallet.wallet_node_api import WalletNodeAPI -from tests.core.data_layer.util import ChiaRoot -from tests.core.node_height import node_height_at_least -from tests.simulation.test_simulation import test_constants_modified -from tests.util.misc import BenchmarkRunner, GcMode, _AssertRuntime, measure_overhead -from tests.util.setup_nodes import ( - OldSimulatorsAndWallets, - SimulatorsAndWallets, - setup_full_system, - setup_n_nodes, - setup_simulators_and_wallets, - setup_simulators_and_wallets_service, - setup_two_nodes, -) -from tests.util.time_out_assert import time_out_assert multiprocessing.set_start_method("spawn") from pathlib import Path +from chia._tests.util.setup_nodes import setup_farmer_multi_harvester from chia.simulator.block_tools import BlockTools, create_block_tools_async, test_constants from chia.simulator.keyring import TempKeyring from chia.util.keyring_wrapper import KeyringWrapper -from tests.util.setup_nodes import setup_farmer_multi_harvester def make_old_setup_simulators_and_wallets(new: SimulatorsAndWallets) -> OldSimulatorsAndWallets: @@ -221,7 +221,7 @@ async def empty_blockchain(latest_db_version, blockchain_constants): """ Provides a list of 10 valid blocks, as well as a blockchain with 9 blocks added to it. """ - from tests.util.blockchain import create_blockchain + from chia._tests.util.blockchain import create_blockchain async with create_blockchain(blockchain_constants, latest_db_version) as (bc1, db_wrapper): yield bc1 @@ -254,7 +254,7 @@ def default_400_blocks(bt, consensus_mode): if consensus_mode == ConsensusMode.HARD_FORK_2_0: version = "_hardfork" - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks return persistent_blocks(400, f"test_blocks_400_{saved_blocks_version}{version}.db", bt, seed=b"400") @@ -265,7 +265,7 @@ def default_1000_blocks(bt, consensus_mode): if consensus_mode == ConsensusMode.HARD_FORK_2_0: version = "_hardfork" - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks return persistent_blocks(1000, f"test_blocks_1000_{saved_blocks_version}{version}.db", bt, seed=b"1000") @@ -276,7 +276,7 @@ def pre_genesis_empty_slots_1000_blocks(bt, consensus_mode): if consensus_mode == ConsensusMode.HARD_FORK_2_0: version = "_hardfork" - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks return persistent_blocks( 1000, @@ -293,14 +293,14 @@ def default_1500_blocks(bt, consensus_mode): if consensus_mode == ConsensusMode.HARD_FORK_2_0: version = "_hardfork" - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks return persistent_blocks(1500, f"test_blocks_1500_{saved_blocks_version}{version}.db", bt, seed=b"1500") @pytest.fixture(scope="session") def default_10000_blocks(bt, consensus_mode): - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks version = "" if consensus_mode == ConsensusMode.HARD_FORK_2_0: @@ -323,7 +323,7 @@ def test_long_reorg_blocks(bt, consensus_mode, default_10000_blocks): if consensus_mode == ConsensusMode.HARD_FORK_2_0: version = "_hardfork" - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks return persistent_blocks( 4500, @@ -345,7 +345,7 @@ def test_long_reorg_blocks_light(bt, consensus_mode, default_10000_blocks): if consensus_mode == ConsensusMode.HARD_FORK_2_0: version = "_hardfork" - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks return persistent_blocks( 4500, @@ -364,7 +364,7 @@ def default_2000_blocks_compact(bt, consensus_mode): if consensus_mode == ConsensusMode.HARD_FORK_2_0: version = "_hardfork" - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks return persistent_blocks( 2000, @@ -380,7 +380,7 @@ def default_2000_blocks_compact(bt, consensus_mode): @pytest.fixture(scope="session") def default_10000_blocks_compact(bt, consensus_mode): - from tests.util.blockchain import persistent_blocks + from chia._tests.util.blockchain import persistent_blocks version = "" if consensus_mode == ConsensusMode.HARD_FORK_2_0: diff --git a/tests/connection_utils.py b/chia/_tests/connection_utils.py similarity index 98% rename from tests/connection_utils.py rename to chia/_tests/connection_utils.py index 7eafc8969c39..cf204aa2c58d 100644 --- a/tests/connection_utils.py +++ b/chia/_tests/connection_utils.py @@ -10,6 +10,7 @@ from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, serialization +from chia._tests.util.time_out_assert import time_out_assert from chia.protocols.shared_protocol import capabilities, protocol_version from chia.server.outbound_message import NodeType from chia.server.server import ChiaServer, ssl_context_for_client @@ -21,7 +22,6 @@ from chia.util.config import load_config from chia.util.ints import uint16 from chia.util.timing import adjusted_timeout -from tests.util.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/core/__init__.py b/chia/_tests/core/__init__.py similarity index 100% rename from tests/core/__init__.py rename to chia/_tests/core/__init__.py diff --git a/tests/core/cmds/__init__.py b/chia/_tests/core/cmds/__init__.py similarity index 100% rename from tests/core/cmds/__init__.py rename to chia/_tests/core/cmds/__init__.py diff --git a/tests/core/cmds/test_beta.py b/chia/_tests/core/cmds/test_beta.py similarity index 100% rename from tests/core/cmds/test_beta.py rename to chia/_tests/core/cmds/test_beta.py diff --git a/tests/core/cmds/test_keys.py b/chia/_tests/core/cmds/test_keys.py similarity index 100% rename from tests/core/cmds/test_keys.py rename to chia/_tests/core/cmds/test_keys.py diff --git a/tests/core/cmds/test_wallet.py b/chia/_tests/core/cmds/test_wallet.py similarity index 100% rename from tests/core/cmds/test_wallet.py rename to chia/_tests/core/cmds/test_wallet.py diff --git a/tests/core/config.py b/chia/_tests/core/config.py similarity index 100% rename from tests/core/config.py rename to chia/_tests/core/config.py diff --git a/tests/core/consensus/__init__.py b/chia/_tests/core/consensus/__init__.py similarity index 100% rename from tests/core/consensus/__init__.py rename to chia/_tests/core/consensus/__init__.py diff --git a/tests/core/consensus/test_block_creation.py b/chia/_tests/core/consensus/test_block_creation.py similarity index 96% rename from tests/core/consensus/test_block_creation.py rename to chia/_tests/core/consensus/test_block_creation.py index 1b4afc6b300f..edf1eed9e675 100644 --- a/tests/core/consensus/test_block_creation.py +++ b/chia/_tests/core/consensus/test_block_creation.py @@ -4,13 +4,13 @@ import pytest +from chia._tests.core.make_block_generator import make_block_generator from chia.consensus.block_creation import compute_block_cost, compute_block_fee from chia.consensus.condition_costs import ConditionCost from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint32 -from tests.core.make_block_generator import make_block_generator @pytest.mark.parametrize("add_amount", [[0], [1, 2, 3], []]) diff --git a/tests/core/consensus/test_pot_iterations.py b/chia/_tests/core/consensus/test_pot_iterations.py similarity index 100% rename from tests/core/consensus/test_pot_iterations.py rename to chia/_tests/core/consensus/test_pot_iterations.py diff --git a/tests/core/custom_types/__init__.py b/chia/_tests/core/custom_types/__init__.py similarity index 100% rename from tests/core/custom_types/__init__.py rename to chia/_tests/core/custom_types/__init__.py diff --git a/tests/core/custom_types/test_coin.py b/chia/_tests/core/custom_types/test_coin.py similarity index 100% rename from tests/core/custom_types/test_coin.py rename to chia/_tests/core/custom_types/test_coin.py diff --git a/tests/core/custom_types/test_proof_of_space.py b/chia/_tests/core/custom_types/test_proof_of_space.py similarity index 99% rename from tests/core/custom_types/test_proof_of_space.py rename to chia/_tests/core/custom_types/test_proof_of_space.py index df6cc1b38ea6..5df0871eae8f 100644 --- a/tests/core/custom_types/test_proof_of_space.py +++ b/chia/_tests/core/custom_types/test_proof_of_space.py @@ -7,11 +7,11 @@ import pytest from chia_rs import G1Element +from chia._tests.util.misc import Marks, datacases from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.proof_of_space import ProofOfSpace, passes_plot_filter, verify_and_get_quality_string from chia.types.blockchain_format.sized_bytes import bytes32, bytes48 from chia.util.ints import uint8, uint32 -from tests.util.misc import Marks, datacases @dataclass diff --git a/tests/core/custom_types/test_spend_bundle.py b/chia/_tests/core/custom_types/test_spend_bundle.py similarity index 100% rename from tests/core/custom_types/test_spend_bundle.py rename to chia/_tests/core/custom_types/test_spend_bundle.py diff --git a/tests/core/daemon/__init__.py b/chia/_tests/core/daemon/__init__.py similarity index 100% rename from tests/core/daemon/__init__.py rename to chia/_tests/core/daemon/__init__.py diff --git a/tests/core/daemon/config.py b/chia/_tests/core/daemon/config.py similarity index 100% rename from tests/core/daemon/config.py rename to chia/_tests/core/daemon/config.py diff --git a/tests/core/daemon/test_daemon.py b/chia/_tests/core/daemon/test_daemon.py similarity index 99% rename from tests/core/daemon/test_daemon.py rename to chia/_tests/core/daemon/test_daemon.py index a04a497fb29a..b81843fbb9a8 100644 --- a/tests/core/daemon/test_daemon.py +++ b/chia/_tests/core/daemon/test_daemon.py @@ -11,6 +11,8 @@ from aiohttp.web_ws import WebSocketResponse from pytest_mock import MockerFixture +from chia._tests.util.misc import Marks, datacases +from chia._tests.util.time_out_assert import time_out_assert_not_none from chia.daemon.client import connect_to_daemon from chia.daemon.keychain_server import ( DeleteLabelRequest, @@ -32,8 +34,6 @@ from chia.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE, KeyringWrapper from chia.util.ws_message import create_payload, create_payload_dict from chia.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_pool_sk -from tests.util.misc import Marks, datacases -from tests.util.time_out_assert import time_out_assert_not_none chiapos_version = pkg_resources.get_distribution("chiapos").version diff --git a/tests/core/daemon/test_daemon_register.py b/chia/_tests/core/daemon/test_daemon_register.py similarity index 100% rename from tests/core/daemon/test_daemon_register.py rename to chia/_tests/core/daemon/test_daemon_register.py diff --git a/tests/core/daemon/test_keychain_proxy.py b/chia/_tests/core/daemon/test_keychain_proxy.py similarity index 100% rename from tests/core/daemon/test_keychain_proxy.py rename to chia/_tests/core/daemon/test_keychain_proxy.py diff --git a/tests/core/data_layer/__init__.py b/chia/_tests/core/data_layer/__init__.py similarity index 100% rename from tests/core/data_layer/__init__.py rename to chia/_tests/core/data_layer/__init__.py diff --git a/tests/core/data_layer/config.py b/chia/_tests/core/data_layer/config.py similarity index 100% rename from tests/core/data_layer/config.py rename to chia/_tests/core/data_layer/config.py diff --git a/tests/core/data_layer/conftest.py b/chia/_tests/core/data_layer/conftest.py similarity index 97% rename from tests/core/data_layer/conftest.py rename to chia/_tests/core/data_layer/conftest.py index 1cddaff523f8..d8c814d1b465 100644 --- a/tests/core/data_layer/conftest.py +++ b/chia/_tests/core/data_layer/conftest.py @@ -11,17 +11,17 @@ # https://github.com/pytest-dev/pytest/issues/7469 from _pytest.fixtures import SubRequest -from chia.data_layer.data_layer_util import NodeType, Status -from chia.data_layer.data_store import DataStore -from chia.types.blockchain_format.sized_bytes import bytes32 -from tests.core.data_layer.util import ( +from chia._tests.core.data_layer.util import ( ChiaRoot, Example, add_0123_example, add_01234567_example, create_valid_node_values, ) -from tests.util.misc import closing_chia_root_popen +from chia._tests.util.misc import closing_chia_root_popen +from chia.data_layer.data_layer_util import NodeType, Status +from chia.data_layer.data_store import DataStore +from chia.types.blockchain_format.sized_bytes import bytes32 # TODO: These are more general than the data layer and should either move elsewhere or # be replaced with an existing common approach. For now they can at least be diff --git a/tests/core/data_layer/test_data_cli.py b/chia/_tests/core/data_layer/test_data_cli.py similarity index 97% rename from tests/core/data_layer/test_data_cli.py rename to chia/_tests/core/data_layer/test_data_cli.py index 51e13683d8da..3ee4d458e4cf 100644 --- a/tests/core/data_layer/test_data_cli.py +++ b/chia/_tests/core/data_layer/test_data_cli.py @@ -5,7 +5,7 @@ import pytest -from tests.core.data_layer.util import ChiaRoot +from chia._tests.core.data_layer.util import ChiaRoot pytestmark = pytest.mark.data_layer diff --git a/tests/core/data_layer/test_data_layer.py b/chia/_tests/core/data_layer/test_data_layer.py similarity index 100% rename from tests/core/data_layer/test_data_layer.py rename to chia/_tests/core/data_layer/test_data_layer.py diff --git a/tests/core/data_layer/test_data_layer_util.py b/chia/_tests/core/data_layer/test_data_layer_util.py similarity index 98% rename from tests/core/data_layer/test_data_layer_util.py rename to chia/_tests/core/data_layer/test_data_layer_util.py index e48e54d5ab72..32fd1a870da1 100644 --- a/tests/core/data_layer/test_data_layer_util.py +++ b/chia/_tests/core/data_layer/test_data_layer_util.py @@ -8,6 +8,7 @@ # TODO: update after resolution in https://github.com/pytest-dev/pytest/issues/7469 from _pytest.fixtures import SubRequest +from chia._tests.util.misc import Marks, datacases from chia.data_layer.data_layer_util import ( ClearPendingRootsRequest, ClearPendingRootsResponse, @@ -19,7 +20,6 @@ ) from chia.rpc.data_layer_rpc_util import MarshallableProtocol from chia.types.blockchain_format.sized_bytes import bytes32 -from tests.util.misc import Marks, datacases pytestmark = pytest.mark.data_layer diff --git a/tests/core/data_layer/test_data_rpc.py b/chia/_tests/core/data_layer/test_data_rpc.py similarity index 99% rename from tests/core/data_layer/test_data_rpc.py rename to chia/_tests/core/data_layer/test_data_rpc.py index bb9f72965fe3..00403ca07c70 100644 --- a/tests/core/data_layer/test_data_rpc.py +++ b/chia/_tests/core/data_layer/test_data_rpc.py @@ -16,6 +16,8 @@ import anyio import pytest +from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert from chia.cmds.data_funcs import clear_pending_roots, wallet_log_in_cmd from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.data_layer.data_layer import DataLayer @@ -42,8 +44,6 @@ from chia.wallet.transaction_record import TransactionRecord from chia.wallet.wallet import Wallet from chia.wallet.wallet_node import WalletNode -from tests.util.setup_nodes import SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert pytestmark = pytest.mark.data_layer nodes = Tuple[WalletNode, FullNodeSimulator] diff --git a/tests/core/data_layer/test_data_store.py b/chia/_tests/core/data_layer/test_data_store.py similarity index 99% rename from tests/core/data_layer/test_data_store.py rename to chia/_tests/core/data_layer/test_data_store.py index 79b67535e548..3b495fe28455 100644 --- a/tests/core/data_layer/test_data_store.py +++ b/chia/_tests/core/data_layer/test_data_store.py @@ -13,6 +13,8 @@ import aiosqlite import pytest +from chia._tests.core.data_layer.util import Example, add_0123_example, add_01234567_example +from chia._tests.util.misc import BenchmarkRunner, Marks, datacases from chia.data_layer.data_layer_errors import NodeHashError, TreeGenerationIncrementingError from chia.data_layer.data_layer_util import ( DiffData, @@ -42,8 +44,6 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.byte_types import hexstr_to_bytes from chia.util.db_wrapper import DBWrapper2, generate_in_memory_db_uri -from tests.core.data_layer.util import Example, add_0123_example, add_01234567_example -from tests.util.misc import BenchmarkRunner, Marks, datacases log = logging.getLogger(__name__) diff --git a/tests/core/data_layer/test_data_store_schema.py b/chia/_tests/core/data_layer/test_data_store_schema.py similarity index 99% rename from tests/core/data_layer/test_data_store_schema.py rename to chia/_tests/core/data_layer/test_data_store_schema.py index 8ad2561675a7..d0750b947716 100644 --- a/tests/core/data_layer/test_data_store_schema.py +++ b/chia/_tests/core/data_layer/test_data_store_schema.py @@ -5,10 +5,10 @@ import pytest +from chia._tests.core.data_layer.util import add_01234567_example, create_valid_node_values from chia.data_layer.data_layer_util import NodeType, Side, Status from chia.data_layer.data_store import DataStore from chia.types.blockchain_format.sized_bytes import bytes32 -from tests.core.data_layer.util import add_01234567_example, create_valid_node_values pytestmark = pytest.mark.data_layer diff --git a/tests/core/data_layer/util.py b/chia/_tests/core/data_layer/util.py similarity index 100% rename from tests/core/data_layer/util.py rename to chia/_tests/core/data_layer/util.py diff --git a/tests/core/farmer/__init__.py b/chia/_tests/core/farmer/__init__.py similarity index 100% rename from tests/core/farmer/__init__.py rename to chia/_tests/core/farmer/__init__.py diff --git a/tests/core/farmer/config.py b/chia/_tests/core/farmer/config.py similarity index 100% rename from tests/core/farmer/config.py rename to chia/_tests/core/farmer/config.py diff --git a/tests/core/farmer/test_farmer_api.py b/chia/_tests/core/farmer/test_farmer_api.py similarity index 92% rename from tests/core/farmer/test_farmer_api.py rename to chia/_tests/core/farmer/test_farmer_api.py index a979cbe7657a..2dc8b2186440 100644 --- a/tests/core/farmer/test_farmer_api.py +++ b/chia/_tests/core/farmer/test_farmer_api.py @@ -5,15 +5,20 @@ import pytest +from chia._tests.conftest import FarmerOneHarvester +from chia._tests.connection_utils import add_dummy_connection, add_dummy_connection_wsc +from chia._tests.util.network_protocol_data import ( + new_signage_point, + request_signed_values, + respond_signatures, + signed_values, +) from chia.farmer.farmer_api import FarmerAPI from chia.protocols import farmer_protocol from chia.protocols.protocol_message_types import ProtocolMessageTypes from chia.server.outbound_message import Message, NodeType from chia.util.hash import std_hash from chia.util.ints import uint8, uint32, uint64 -from tests.conftest import FarmerOneHarvester -from tests.connection_utils import add_dummy_connection, add_dummy_connection_wsc -from tests.util.network_protocol_data import new_signage_point, request_signed_values, respond_signatures, signed_values T = TypeVar("T") diff --git a/tests/core/full_node/__init__.py b/chia/_tests/core/full_node/__init__.py similarity index 100% rename from tests/core/full_node/__init__.py rename to chia/_tests/core/full_node/__init__.py diff --git a/tests/core/full_node/config.py b/chia/_tests/core/full_node/config.py similarity index 100% rename from tests/core/full_node/config.py rename to chia/_tests/core/full_node/config.py diff --git a/tests/core/full_node/dos/__init__.py b/chia/_tests/core/full_node/dos/__init__.py similarity index 100% rename from tests/core/full_node/dos/__init__.py rename to chia/_tests/core/full_node/dos/__init__.py diff --git a/tests/core/full_node/dos/config.py b/chia/_tests/core/full_node/dos/config.py similarity index 100% rename from tests/core/full_node/dos/config.py rename to chia/_tests/core/full_node/dos/config.py diff --git a/tests/core/full_node/full_sync/__init__.py b/chia/_tests/core/full_node/full_sync/__init__.py similarity index 100% rename from tests/core/full_node/full_sync/__init__.py rename to chia/_tests/core/full_node/full_sync/__init__.py diff --git a/tests/core/full_node/full_sync/config.py b/chia/_tests/core/full_node/full_sync/config.py similarity index 100% rename from tests/core/full_node/full_sync/config.py rename to chia/_tests/core/full_node/full_sync/config.py diff --git a/tests/core/full_node/full_sync/test_full_sync.py b/chia/_tests/core/full_node/full_sync/test_full_sync.py similarity index 99% rename from tests/core/full_node/full_sync/test_full_sync.py rename to chia/_tests/core/full_node/full_sync/test_full_sync.py index d3862a3ac76d..8b1ee2e97636 100644 --- a/tests/core/full_node/full_sync/test_full_sync.py +++ b/chia/_tests/core/full_node/full_sync/test_full_sync.py @@ -9,6 +9,9 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.core.node_height import node_height_between, node_height_exactly +from chia._tests.util.time_out_assert import time_out_assert from chia.full_node.full_node import FullNode from chia.full_node.full_node_api import FullNodeAPI from chia.protocols import full_node_protocol @@ -19,9 +22,6 @@ from chia.types.peer_info import PeerInfo from chia.util.hash import std_hash from chia.util.ints import uint16 -from tests.conftest import ConsensusMode -from tests.core.node_height import node_height_between, node_height_exactly -from tests.util.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/core/full_node/ram_db.py b/chia/_tests/core/full_node/ram_db.py similarity index 100% rename from tests/core/full_node/ram_db.py rename to chia/_tests/core/full_node/ram_db.py diff --git a/tests/core/full_node/stores/__init__.py b/chia/_tests/core/full_node/stores/__init__.py similarity index 100% rename from tests/core/full_node/stores/__init__.py rename to chia/_tests/core/full_node/stores/__init__.py diff --git a/tests/core/full_node/stores/config.py b/chia/_tests/core/full_node/stores/config.py similarity index 100% rename from tests/core/full_node/stores/config.py rename to chia/_tests/core/full_node/stores/config.py diff --git a/tests/core/full_node/stores/test_block_store.py b/chia/_tests/core/full_node/stores/test_block_store.py similarity index 99% rename from tests/core/full_node/stores/test_block_store.py rename to chia/_tests/core/full_node/stores/test_block_store.py index 244a4bcca729..3205bd712f26 100644 --- a/tests/core/full_node/stores/test_block_store.py +++ b/chia/_tests/core/full_node/stores/test_block_store.py @@ -14,6 +14,8 @@ from _pytest.fixtures import SubRequest from clvm.casts import int_to_bytes +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block +from chia._tests.util.db_connection import DBConnection, PathDBConnection from chia.consensus.blockchain import Blockchain from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.consensus.full_block_to_block_record import header_block_to_sub_block_record @@ -29,8 +31,6 @@ from chia.util.db_wrapper import get_host_parameter_limit from chia.util.full_block_utils import GeneratorBlockInfo from chia.util.ints import uint8, uint32, uint64 -from tests.blockchain.blockchain_test_utils import _validate_and_add_block -from tests.util.db_connection import DBConnection, PathDBConnection log = logging.getLogger(__name__) diff --git a/tests/core/full_node/stores/test_coin_store.py b/chia/_tests/core/full_node/stores/test_coin_store.py similarity index 99% rename from tests/core/full_node/stores/test_coin_store.py rename to chia/_tests/core/full_node/stores/test_coin_store.py index 9a3c50a2b7f9..af45d675e045 100644 --- a/tests/core/full_node/stores/test_coin_store.py +++ b/chia/_tests/core/full_node/stores/test_coin_store.py @@ -6,6 +6,8 @@ import pytest +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block +from chia._tests.util.db_connection import DBConnection from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.consensus.blockchain import AddBlockResult, Blockchain from chia.consensus.coinbase import create_farmer_coin, create_pool_coin @@ -22,8 +24,6 @@ from chia.util.generator_tools import tx_removals_and_additions from chia.util.hash import std_hash from chia.util.ints import uint32, uint64 -from tests.blockchain.blockchain_test_utils import _validate_and_add_block -from tests.util.db_connection import DBConnection constants = test_constants diff --git a/tests/core/full_node/stores/test_full_node_store.py b/chia/_tests/core/full_node/stores/test_full_node_store.py similarity index 99% rename from tests/core/full_node/stores/test_full_node_store.py rename to chia/_tests/core/full_node/stores/test_full_node_store.py index 3cc476dc80bd..ba1dab91e2cd 100644 --- a/tests/core/full_node/stores/test_full_node_store.py +++ b/chia/_tests/core/full_node/stores/test_full_node_store.py @@ -7,6 +7,8 @@ import pytest +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block, _validate_and_add_block_no_error +from chia._tests.util.blockchain import create_blockchain from chia.consensus.blockchain import AddBlockResult, Blockchain from chia.consensus.constants import ConsensusConstants from chia.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty @@ -25,8 +27,6 @@ from chia.util.block_cache import BlockCache from chia.util.hash import std_hash from chia.util.ints import uint8, uint32, uint64, uint128 -from tests.blockchain.blockchain_test_utils import _validate_and_add_block, _validate_and_add_block_no_error -from tests.util.blockchain import create_blockchain log = logging.getLogger(__name__) diff --git a/tests/core/full_node/stores/test_hint_store.py b/chia/_tests/core/full_node/stores/test_hint_store.py similarity index 99% rename from tests/core/full_node/stores/test_hint_store.py rename to chia/_tests/core/full_node/stores/test_hint_store.py index effb2b393341..a8e0080ed1ee 100644 --- a/tests/core/full_node/stores/test_hint_store.py +++ b/chia/_tests/core/full_node/stores/test_hint_store.py @@ -6,6 +6,7 @@ import pytest from clvm.casts import int_to_bytes +from chia._tests.util.db_connection import DBConnection from chia.full_node.hint_store import HintStore from chia.server.server import ChiaServer from chia.simulator.block_tools import BlockTools @@ -17,7 +18,6 @@ from chia.types.condition_with_args import ConditionWithArgs from chia.types.spend_bundle import SpendBundle from chia.util.ints import uint64 -from tests.util.db_connection import DBConnection log = logging.getLogger(__name__) diff --git a/tests/core/full_node/stores/test_sync_store.py b/chia/_tests/core/full_node/stores/test_sync_store.py similarity index 100% rename from tests/core/full_node/stores/test_sync_store.py rename to chia/_tests/core/full_node/stores/test_sync_store.py diff --git a/tests/core/full_node/test_address_manager.py b/chia/_tests/core/full_node/test_address_manager.py similarity index 100% rename from tests/core/full_node/test_address_manager.py rename to chia/_tests/core/full_node/test_address_manager.py diff --git a/tests/core/full_node/test_block_height_map.py b/chia/_tests/core/full_node/test_block_height_map.py similarity index 99% rename from tests/core/full_node/test_block_height_map.py rename to chia/_tests/core/full_node/test_block_height_map.py index 27510065041e..a776d11af0b7 100644 --- a/tests/core/full_node/test_block_height_map.py +++ b/chia/_tests/core/full_node/test_block_height_map.py @@ -7,13 +7,13 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.full_node.block_height_map import BlockHeightMap, SesCache from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary from chia.util.db_wrapper import DBWrapper2 from chia.util.files import write_file_async from chia.util.ints import uint8, uint32 -from tests.util.db_connection import DBConnection def gen_block_hash(height: int) -> bytes32: diff --git a/tests/core/full_node/test_conditions.py b/chia/_tests/core/full_node/test_conditions.py similarity index 99% rename from tests/core/full_node/test_conditions.py rename to chia/_tests/core/full_node/test_conditions.py index 85f73ab43312..d21491f890ac 100644 --- a/tests/core/full_node/test_conditions.py +++ b/chia/_tests/core/full_node/test_conditions.py @@ -12,6 +12,7 @@ from chia_rs import G2Element from clvm_tools.binutils import assemble +from chia._tests.conftest import ConsensusMode from chia.simulator.block_tools import BlockTools from chia.simulator.keyring import TempKeyring from chia.types.announcement import Announcement @@ -24,7 +25,6 @@ from chia.types.spend_bundle import SpendBundle from chia.util.errors import Err from chia.util.ints import uint32, uint64 -from tests.conftest import ConsensusMode from ...blockchain.blockchain_test_utils import _validate_and_add_block from .ram_db import create_ram_blockchain diff --git a/tests/core/full_node/test_full_node.py b/chia/_tests/core/full_node/test_full_node.py similarity index 99% rename from tests/core/full_node/test_full_node.py rename to chia/_tests/core/full_node/test_full_node.py index bb4ca1db742d..b3fedbdd6e23 100644 --- a/tests/core/full_node/test_full_node.py +++ b/chia/_tests/core/full_node/test_full_node.py @@ -12,6 +12,15 @@ from chia_rs import AugSchemeMPL, G2Element, PrivateKey from clvm.casts import int_to_bytes +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block, _validate_and_add_block_no_error +from chia._tests.conftest import ConsensusMode +from chia._tests.connection_utils import add_dummy_connection, connect_and_get_peer +from chia._tests.core.full_node.stores.test_coin_store import get_future_reward_coins +from chia._tests.core.make_block_generator import make_spend_bundle +from chia._tests.core.mempool.test_mempool_performance import wallet_height_at_least +from chia._tests.core.node_height import node_height_at_least +from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval, time_out_messages from chia.consensus.block_body_validation import ForkInfo from chia.consensus.pot_iterations import is_overflow_block from chia.full_node.bundle_tools import detect_potential_template_generator @@ -58,15 +67,6 @@ from chia.util.recursive_replace import recursive_replace from chia.util.vdf_prover import get_vdf_info_and_proof from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from tests.blockchain.blockchain_test_utils import _validate_and_add_block, _validate_and_add_block_no_error -from tests.conftest import ConsensusMode -from tests.connection_utils import add_dummy_connection, connect_and_get_peer -from tests.core.full_node.stores.test_coin_store import get_future_reward_coins -from tests.core.make_block_generator import make_spend_bundle -from tests.core.mempool.test_mempool_performance import wallet_height_at_least -from tests.core.node_height import node_height_at_least -from tests.util.setup_nodes import SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval, time_out_messages async def new_transaction_not_requested(incoming, new_spend): diff --git a/tests/core/full_node/test_generator_tools.py b/chia/_tests/core/full_node/test_generator_tools.py similarity index 100% rename from tests/core/full_node/test_generator_tools.py rename to chia/_tests/core/full_node/test_generator_tools.py diff --git a/tests/core/full_node/test_hint_management.py b/chia/_tests/core/full_node/test_hint_management.py similarity index 98% rename from tests/core/full_node/test_hint_management.py rename to chia/_tests/core/full_node/test_hint_management.py index 79a696cee302..50eacbfdadd8 100644 --- a/tests/core/full_node/test_hint_management.py +++ b/chia/_tests/core/full_node/test_hint_management.py @@ -4,6 +4,7 @@ import pytest +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block from chia.consensus.block_record import BlockRecord from chia.consensus.blockchain import Blockchain, StateChangeSummary from chia.full_node.hint_management import get_hints_and_subscription_coin_ids @@ -12,7 +13,6 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.hash import std_hash from chia.util.ints import uint32, uint64 -from tests.blockchain.blockchain_test_utils import _validate_and_add_block coin_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)] parent_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)] diff --git a/tests/core/full_node/test_node_load.py b/chia/_tests/core/full_node/test_node_load.py similarity index 87% rename from tests/core/full_node/test_node_load.py rename to chia/_tests/core/full_node/test_node_load.py index c88dd461018f..8fb6ced95c31 100644 --- a/tests/core/full_node/test_node_load.py +++ b/chia/_tests/core/full_node/test_node_load.py @@ -2,10 +2,10 @@ import pytest +from chia._tests.connection_utils import connect_and_get_peer +from chia._tests.util.misc import BenchmarkRunner +from chia._tests.util.time_out_assert import time_out_assert from chia.types.peer_info import PeerInfo -from tests.connection_utils import connect_and_get_peer -from tests.util.misc import BenchmarkRunner -from tests.util.time_out_assert import time_out_assert class TestNodeLoad: diff --git a/tests/core/full_node/test_peer_store_resolver.py b/chia/_tests/core/full_node/test_peer_store_resolver.py similarity index 100% rename from tests/core/full_node/test_peer_store_resolver.py rename to chia/_tests/core/full_node/test_peer_store_resolver.py diff --git a/tests/core/full_node/test_performance.py b/chia/_tests/core/full_node/test_performance.py similarity index 95% rename from tests/core/full_node/test_performance.py rename to chia/_tests/core/full_node/test_performance.py index 46401430bbe8..816b056280a2 100644 --- a/tests/core/full_node/test_performance.py +++ b/chia/_tests/core/full_node/test_performance.py @@ -9,6 +9,11 @@ import pytest from clvm.casts import int_to_bytes +from chia._tests.connection_utils import add_dummy_connection +from chia._tests.core.full_node.stores.test_coin_store import get_future_reward_coins +from chia._tests.core.node_height import node_height_at_least +from chia._tests.util.misc import BenchmarkRunner +from chia._tests.util.time_out_assert import time_out_assert from chia.consensus.block_record import BlockRecord from chia.consensus.pot_iterations import is_overflow_block from chia.full_node.full_node_api import FullNodeAPI @@ -17,11 +22,6 @@ from chia.types.condition_with_args import ConditionWithArgs from chia.types.unfinished_block import UnfinishedBlock from chia.util.ints import uint64 -from tests.connection_utils import add_dummy_connection -from tests.core.full_node.stores.test_coin_store import get_future_reward_coins -from tests.core.node_height import node_height_at_least -from tests.util.misc import BenchmarkRunner -from tests.util.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/core/full_node/test_subscriptions.py b/chia/_tests/core/full_node/test_subscriptions.py similarity index 100% rename from tests/core/full_node/test_subscriptions.py rename to chia/_tests/core/full_node/test_subscriptions.py diff --git a/tests/core/full_node/test_transactions.py b/chia/_tests/core/full_node/test_transactions.py similarity index 99% rename from tests/core/full_node/test_transactions.py rename to chia/_tests/core/full_node/test_transactions.py index cd1aa86c0685..c22a1bc0f042 100644 --- a/tests/core/full_node/test_transactions.py +++ b/chia/_tests/core/full_node/test_transactions.py @@ -6,6 +6,7 @@ import pytest +from chia._tests.util.time_out_assert import time_out_assert from chia.consensus.block_record import BlockRecord from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.full_node.full_node_api import FullNodeAPI @@ -14,7 +15,6 @@ from chia.types.peer_info import PeerInfo from chia.util.ints import uint32 from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from tests.util.time_out_assert import time_out_assert class TestTransactions: diff --git a/tests/core/full_node/test_tx_processing_queue.py b/chia/_tests/core/full_node/test_tx_processing_queue.py similarity index 100% rename from tests/core/full_node/test_tx_processing_queue.py rename to chia/_tests/core/full_node/test_tx_processing_queue.py diff --git a/tests/core/large_block.py b/chia/_tests/core/large_block.py similarity index 100% rename from tests/core/large_block.py rename to chia/_tests/core/large_block.py diff --git a/tests/core/make_block_generator.py b/chia/_tests/core/make_block_generator.py similarity index 100% rename from tests/core/make_block_generator.py rename to chia/_tests/core/make_block_generator.py diff --git a/tests/core/mempool/__init__.py b/chia/_tests/core/mempool/__init__.py similarity index 100% rename from tests/core/mempool/__init__.py rename to chia/_tests/core/mempool/__init__.py diff --git a/tests/core/mempool/config.py b/chia/_tests/core/mempool/config.py similarity index 100% rename from tests/core/mempool/config.py rename to chia/_tests/core/mempool/config.py diff --git a/tests/core/mempool/test_mempool.py b/chia/_tests/core/mempool/test_mempool.py similarity index 99% rename from tests/core/mempool/test_mempool.py rename to chia/_tests/core/mempool/test_mempool.py index 8c9c8c3d1186..c96af10f1e09 100644 --- a/tests/core/mempool/test_mempool.py +++ b/chia/_tests/core/mempool/test_mempool.py @@ -10,6 +10,19 @@ from clvm.casts import int_to_bytes from clvm_tools import binutils +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block +from chia._tests.connection_utils import add_dummy_connection, connect_and_get_peer +from chia._tests.core.mempool.test_mempool_manager import ( + IDENTITY_PUZZLE_HASH, + TEST_COIN, + make_test_coins, + mempool_item_from_spendbundle, + mk_item, + spend_bundle_from_conditions, +) +from chia._tests.core.node_height import node_height_at_least +from chia._tests.util.misc import BenchmarkRunner, invariant_check_mempool +from chia._tests.util.time_out_assert import time_out_assert from chia.consensus.condition_costs import ConditionCost from chia.consensus.cost_calculator import NPCResult from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator @@ -47,19 +60,6 @@ from chia.util.hash import std_hash from chia.util.ints import uint32, uint64 from chia.util.recursive_replace import recursive_replace -from tests.blockchain.blockchain_test_utils import _validate_and_add_block -from tests.connection_utils import add_dummy_connection, connect_and_get_peer -from tests.core.mempool.test_mempool_manager import ( - IDENTITY_PUZZLE_HASH, - TEST_COIN, - make_test_coins, - mempool_item_from_spendbundle, - mk_item, - spend_bundle_from_conditions, -) -from tests.core.node_height import node_height_at_least -from tests.util.misc import BenchmarkRunner, invariant_check_mempool -from tests.util.time_out_assert import time_out_assert BURN_PUZZLE_HASH = bytes32(b"0" * 32) BURN_PUZZLE_HASH_2 = bytes32(b"1" * 32) diff --git a/tests/core/mempool/test_mempool_fee_estimator.py b/chia/_tests/core/mempool/test_mempool_fee_estimator.py similarity index 96% rename from tests/core/mempool/test_mempool_fee_estimator.py rename to chia/_tests/core/mempool/test_mempool_fee_estimator.py index 86377d5b90e5..04fe103dd509 100644 --- a/tests/core/mempool/test_mempool_fee_estimator.py +++ b/chia/_tests/core/mempool/test_mempool_fee_estimator.py @@ -4,6 +4,8 @@ import pytest +from chia._tests.core.consensus.test_pot_iterations import test_constants +from chia._tests.util.db_connection import DBConnection from chia.full_node.bitcoin_fee_estimator import BitcoinFeeEstimator from chia.full_node.coin_store import CoinStore from chia.full_node.fee_estimate_store import FeeStore @@ -12,8 +14,6 @@ from chia.full_node.fee_tracker import FeeTracker from chia.full_node.mempool_manager import MempoolManager from chia.util.ints import uint32, uint64 -from tests.core.consensus.test_pot_iterations import test_constants -from tests.util.db_connection import DBConnection @pytest.mark.anyio diff --git a/tests/core/mempool/test_mempool_fee_protocol.py b/chia/_tests/core/mempool/test_mempool_fee_protocol.py similarity index 94% rename from tests/core/mempool/test_mempool_fee_protocol.py rename to chia/_tests/core/mempool/test_mempool_fee_protocol.py index 5e372e1f6be5..0baa80821c85 100644 --- a/tests/core/mempool/test_mempool_fee_protocol.py +++ b/chia/_tests/core/mempool/test_mempool_fee_protocol.py @@ -5,6 +5,8 @@ import pytest +from chia._tests.core.node_height import node_height_at_least +from chia._tests.util.time_out_assert import time_out_assert from chia.full_node.full_node_api import FullNodeAPI from chia.protocols import wallet_protocol from chia.protocols.protocol_message_types import ProtocolMessageTypes @@ -14,8 +16,6 @@ from chia.simulator.full_node_simulator import FullNodeSimulator from chia.util.ints import uint64 from chia.wallet.wallet import Wallet -from tests.core.node_height import node_height_at_least -from tests.util.time_out_assert import time_out_assert @pytest.mark.anyio diff --git a/tests/core/mempool/test_mempool_manager.py b/chia/_tests/core/mempool/test_mempool_manager.py similarity index 99% rename from tests/core/mempool/test_mempool_manager.py rename to chia/_tests/core/mempool/test_mempool_manager.py index 9c17c63077f8..be18eee14602 100644 --- a/tests/core/mempool/test_mempool_manager.py +++ b/chia/_tests/core/mempool/test_mempool_manager.py @@ -7,6 +7,8 @@ from chia_rs import ELIGIBLE_FOR_DEDUP, G1Element, G2Element from chiabip158 import PyBIP158 +from chia._tests.util.misc import invariant_check_mempool +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets from chia.consensus.constants import ConsensusConstants from chia.consensus.cost_calculator import NPCResult from chia.consensus.default_constants import DEFAULT_CONSTANTS @@ -46,8 +48,6 @@ from chia.wallet.wallet import Wallet from chia.wallet.wallet_coin_record import WalletCoinRecord from chia.wallet.wallet_node import WalletNode -from tests.util.misc import invariant_check_mempool -from tests.util.setup_nodes import OldSimulatorsAndWallets IDENTITY_PUZZLE = SerializedProgram.to(1) IDENTITY_PUZZLE_HASH = IDENTITY_PUZZLE.get_tree_hash() diff --git a/tests/core/mempool/test_mempool_performance.py b/chia/_tests/core/mempool/test_mempool_performance.py similarity index 93% rename from tests/core/mempool/test_mempool_performance.py rename to chia/_tests/core/mempool/test_mempool_performance.py index f2aa3cb15402..81a95acd30e0 100644 --- a/tests/core/mempool/test_mempool_performance.py +++ b/chia/_tests/core/mempool/test_mempool_performance.py @@ -4,15 +4,15 @@ import pytest +from chia._tests.util.misc import BenchmarkRunner +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets +from chia._tests.util.time_out_assert import time_out_assert from chia.types.full_block import FullBlock from chia.types.mempool_inclusion_status import MempoolInclusionStatus from chia.types.peer_info import PeerInfo from chia.util.ints import uint32, uint64, uint128 from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.wallet_node import WalletNode -from tests.util.misc import BenchmarkRunner -from tests.util.setup_nodes import OldSimulatorsAndWallets -from tests.util.time_out_assert import time_out_assert async def wallet_height_at_least(wallet_node: WalletNode, h: uint32) -> bool: diff --git a/tests/core/node_height.py b/chia/_tests/core/node_height.py similarity index 100% rename from tests/core/node_height.py rename to chia/_tests/core/node_height.py diff --git a/tests/core/server/__init__.py b/chia/_tests/core/server/__init__.py similarity index 100% rename from tests/core/server/__init__.py rename to chia/_tests/core/server/__init__.py diff --git a/tests/core/server/config.py b/chia/_tests/core/server/config.py similarity index 100% rename from tests/core/server/config.py rename to chia/_tests/core/server/config.py diff --git a/tests/core/server/flood.py b/chia/_tests/core/server/flood.py similarity index 98% rename from tests/core/server/flood.py rename to chia/_tests/core/server/flood.py index 894885862d25..5e05f5286428 100644 --- a/tests/core/server/flood.py +++ b/chia/_tests/core/server/flood.py @@ -8,7 +8,7 @@ import sys import time -from tests.util.misc import create_logger +from chia._tests.util.misc import create_logger # TODO: CAMPid 0945094189459712842390t591 IP = "127.0.0.1" diff --git a/tests/core/server/serve.py b/chia/_tests/core/server/serve.py similarity index 98% rename from tests/core/server/serve.py rename to chia/_tests/core/server/serve.py index a5586c125145..3908911733e3 100644 --- a/tests/core/server/serve.py +++ b/chia/_tests/core/server/serve.py @@ -11,9 +11,9 @@ import threading from typing import List, Optional, final, overload +from chia._tests.util.misc import create_logger from chia.server.chia_policy import ChiaPolicy from chia.server.start_service import async_run -from tests.util.misc import create_logger if sys.platform == "win32": import _winapi diff --git a/tests/core/server/test_capabilities.py b/chia/_tests/core/server/test_capabilities.py similarity index 100% rename from tests/core/server/test_capabilities.py rename to chia/_tests/core/server/test_capabilities.py diff --git a/tests/core/server/test_dos.py b/chia/_tests/core/server/test_dos.py similarity index 99% rename from tests/core/server/test_dos.py rename to chia/_tests/core/server/test_dos.py index 5d8d11373742..bd07969b620c 100644 --- a/tests/core/server/test_dos.py +++ b/chia/_tests/core/server/test_dos.py @@ -7,6 +7,7 @@ import pytest from aiohttp import ClientSession, ClientTimeout, ServerDisconnectedError, WSCloseCode, WSMessage, WSMsgType +from chia._tests.util.time_out_assert import time_out_assert from chia.full_node.full_node_api import FullNodeAPI from chia.protocols import full_node_protocol from chia.protocols.protocol_message_types import ProtocolMessageTypes @@ -17,7 +18,6 @@ from chia.types.peer_info import PeerInfo from chia.util.errors import Err from chia.util.ints import uint64 -from tests.util.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/core/server/test_event_loop.py b/chia/_tests/core/server/test_event_loop.py similarity index 100% rename from tests/core/server/test_event_loop.py rename to chia/_tests/core/server/test_event_loop.py diff --git a/tests/core/server/test_loop.py b/chia/_tests/core/server/test_loop.py similarity index 98% rename from tests/core/server/test_loop.py rename to chia/_tests/core/server/test_loop.py index b0a165756770..7f0e8c6435ba 100644 --- a/tests/core/server/test_loop.py +++ b/chia/_tests/core/server/test_loop.py @@ -14,11 +14,11 @@ import anyio import pytest -import tests +import chia._tests +from chia._tests.core.server import serve +from chia._tests.util.misc import create_logger from chia.server import chia_policy from chia.util.timing import adjusted_timeout -from tests.core.server import serve -from tests.util.misc import create_logger here = pathlib.Path(__file__).parent diff --git a/tests/core/server/test_node_discovery.py b/chia/_tests/core/server/test_node_discovery.py similarity index 100% rename from tests/core/server/test_node_discovery.py rename to chia/_tests/core/server/test_node_discovery.py diff --git a/tests/core/server/test_rate_limits.py b/chia/_tests/core/server/test_rate_limits.py similarity index 99% rename from tests/core/server/test_rate_limits.py rename to chia/_tests/core/server/test_rate_limits.py index 488eed319b71..1d761b3d7243 100644 --- a/tests/core/server/test_rate_limits.py +++ b/chia/_tests/core/server/test_rate_limits.py @@ -5,6 +5,7 @@ import pytest +from chia._tests.conftest import node_with_params from chia.protocols.protocol_message_types import ProtocolMessageTypes from chia.protocols.shared_protocol import Capability from chia.server.outbound_message import make_msg @@ -14,7 +15,6 @@ from chia.server.server import ChiaServer from chia.server.ws_connection import WSChiaConnection from chia.types.peer_info import PeerInfo -from tests.conftest import node_with_params rl_v2 = [Capability.BASE, Capability.BLOCK_HEADERS, Capability.RATE_LIMITS_V2] rl_v1 = [Capability.BASE] diff --git a/tests/core/server/test_server.py b/chia/_tests/core/server/test_server.py similarity index 98% rename from tests/core/server/test_server.py rename to chia/_tests/core/server/test_server.py index f2fca59f9534..9e255327bce6 100644 --- a/tests/core/server/test_server.py +++ b/chia/_tests/core/server/test_server.py @@ -7,6 +7,9 @@ import pytest from packaging.version import Version +from chia._tests.connection_utils import connect_and_get_peer +from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert from chia.cmds.init_funcs import chia_full_version_str from chia.full_node.full_node_api import FullNodeAPI from chia.protocols.full_node_protocol import RejectBlock, RequestBlock, RequestTransaction @@ -24,9 +27,6 @@ from chia.util.api_decorators import api_request from chia.util.errors import ApiError, Err from chia.util.ints import int16, uint32 -from tests.connection_utils import connect_and_get_peer -from tests.util.setup_nodes import SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert @dataclass diff --git a/tests/core/server/test_upnp.py b/chia/_tests/core/server/test_upnp.py similarity index 100% rename from tests/core/server/test_upnp.py rename to chia/_tests/core/server/test_upnp.py diff --git a/tests/core/services/__init__.py b/chia/_tests/core/services/__init__.py similarity index 100% rename from tests/core/services/__init__.py rename to chia/_tests/core/services/__init__.py diff --git a/tests/core/services/config.py b/chia/_tests/core/services/config.py similarity index 100% rename from tests/core/services/config.py rename to chia/_tests/core/services/config.py diff --git a/tests/core/services/test_services.py b/chia/_tests/core/services/test_services.py similarity index 98% rename from tests/core/services/test_services.py rename to chia/_tests/core/services/test_services.py index 12531bfe4f49..24447ec9d73c 100644 --- a/tests/core/services/test_services.py +++ b/chia/_tests/core/services/test_services.py @@ -11,6 +11,8 @@ import pytest from typing_extensions import Protocol +from chia._tests.core.data_layer.util import ChiaRoot +from chia._tests.util.misc import closing_chia_root_popen from chia.daemon.client import DaemonProxy, connect_to_daemon_and_validate from chia.rpc.data_layer_rpc_client import DataLayerRpcClient from chia.rpc.farmer_rpc_client import FarmerRpcClient @@ -23,8 +25,6 @@ from chia.util.ints import uint16 from chia.util.misc import sendable_termination_signals from chia.util.timing import adjusted_timeout -from tests.core.data_layer.util import ChiaRoot -from tests.util.misc import closing_chia_root_popen class CreateServiceProtocol(Protocol): diff --git a/tests/core/ssl/__init__.py b/chia/_tests/core/ssl/__init__.py similarity index 100% rename from tests/core/ssl/__init__.py rename to chia/_tests/core/ssl/__init__.py diff --git a/tests/core/ssl/config.py b/chia/_tests/core/ssl/config.py similarity index 100% rename from tests/core/ssl/config.py rename to chia/_tests/core/ssl/config.py diff --git a/tests/core/ssl/test_ssl.py b/chia/_tests/core/ssl/test_ssl.py similarity index 100% rename from tests/core/ssl/test_ssl.py rename to chia/_tests/core/ssl/test_ssl.py diff --git a/tests/core/test_coins.py b/chia/_tests/core/test_coins.py similarity index 94% rename from tests/core/test_coins.py rename to chia/_tests/core/test_coins.py index f81fc1a08736..198c97529f6e 100644 --- a/tests/core/test_coins.py +++ b/chia/_tests/core/test_coins.py @@ -2,10 +2,10 @@ from itertools import permutations +from chia._tests.util.benchmarks import rand_hash from chia.types.blockchain_format.coin import hash_coin_ids from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.hash import std_hash -from tests.util.benchmarks import rand_hash def test_hash_coin_ids_empty() -> None: diff --git a/tests/core/test_cost_calculation.py b/chia/_tests/core/test_cost_calculation.py similarity index 99% rename from tests/core/test_cost_calculation.py rename to chia/_tests/core/test_cost_calculation.py index 0f44d5634598..bbd289410b1c 100644 --- a/tests/core/test_cost_calculation.py +++ b/chia/_tests/core/test_cost_calculation.py @@ -8,6 +8,7 @@ from chia_rs import G1Element from clvm_tools import binutils +from chia._tests.util.misc import BenchmarkRunner from chia.consensus.condition_costs import ConditionCost from chia.consensus.cost_calculator import NPCResult from chia.consensus.default_constants import DEFAULT_CONSTANTS @@ -21,7 +22,6 @@ from chia.types.generator_types import BlockGenerator from chia.util.ints import uint32, uint64 from chia.wallet.puzzles import p2_delegated_puzzle_or_hidden_puzzle -from tests.util.misc import BenchmarkRunner from .make_block_generator import make_block_generator @@ -289,8 +289,8 @@ async def test_standard_tx(benchmark_runner: BenchmarkRunner) -> None: async def test_get_puzzle_and_solution_for_coin_performance(benchmark_runner: BenchmarkRunner) -> None: from clvm.casts import int_from_bytes + from chia._tests.core.large_block import LARGE_BLOCK from chia.full_node.mempool_check_conditions import DESERIALIZE_MOD - from tests.core.large_block import LARGE_BLOCK spends: List[Coin] = [] diff --git a/tests/core/test_crawler.py b/chia/_tests/core/test_crawler.py similarity index 96% rename from tests/core/test_crawler.py rename to chia/_tests/core/test_crawler.py index e0b84b2af70f..0c5ad6452cb0 100644 --- a/tests/core/test_crawler.py +++ b/chia/_tests/core/test_crawler.py @@ -6,6 +6,8 @@ import pytest +from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert from chia.full_node.full_node_api import FullNodeAPI from chia.protocols.full_node_protocol import NewPeak from chia.protocols.protocol_message_types import ProtocolMessageTypes @@ -16,8 +18,6 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.peer_info import PeerInfo from chia.util.ints import uint32, uint64, uint128 -from tests.util.setup_nodes import SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert @pytest.mark.anyio diff --git a/tests/core/test_crawler_rpc.py b/chia/_tests/core/test_crawler_rpc.py similarity index 100% rename from tests/core/test_crawler_rpc.py rename to chia/_tests/core/test_crawler_rpc.py diff --git a/tests/core/test_daemon_rpc.py b/chia/_tests/core/test_daemon_rpc.py similarity index 100% rename from tests/core/test_daemon_rpc.py rename to chia/_tests/core/test_daemon_rpc.py diff --git a/tests/core/test_db_conversion.py b/chia/_tests/core/test_db_conversion.py similarity index 99% rename from tests/core/test_db_conversion.py rename to chia/_tests/core/test_db_conversion.py index 16ca2be37a1f..34d4b2afd112 100644 --- a/tests/core/test_db_conversion.py +++ b/chia/_tests/core/test_db_conversion.py @@ -6,6 +6,7 @@ import pytest +from chia._tests.util.temp_file import TempFile from chia.cmds.db_upgrade_func import convert_v1_to_v2 from chia.consensus.blockchain import Blockchain from chia.consensus.multiprocess_validation import PreValidationResult @@ -16,7 +17,6 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.db_wrapper import DBWrapper2 from chia.util.ints import uint64 -from tests.util.temp_file import TempFile def rand_bytes(num) -> bytes: diff --git a/tests/core/test_db_validation.py b/chia/_tests/core/test_db_validation.py similarity index 99% rename from tests/core/test_db_validation.py rename to chia/_tests/core/test_db_validation.py index 131ce91dbc45..4d444229b215 100644 --- a/tests/core/test_db_validation.py +++ b/chia/_tests/core/test_db_validation.py @@ -8,6 +8,7 @@ import pytest +from chia._tests.util.temp_file import TempFile from chia.cmds.db_validate_func import validate_v2 from chia.consensus.blockchain import Blockchain from chia.consensus.default_constants import DEFAULT_CONSTANTS @@ -19,7 +20,6 @@ from chia.types.full_block import FullBlock from chia.util.db_wrapper import DBWrapper2 from chia.util.ints import uint64 -from tests.util.temp_file import TempFile def rand_hash() -> bytes32: diff --git a/tests/core/test_farmer_harvester_rpc.py b/chia/_tests/core/test_farmer_harvester_rpc.py similarity index 98% rename from tests/core/test_farmer_harvester_rpc.py rename to chia/_tests/core/test_farmer_harvester_rpc.py index aa9ef8267e1f..6a5f36a46454 100644 --- a/tests/core/test_farmer_harvester_rpc.py +++ b/chia/_tests/core/test_farmer_harvester_rpc.py @@ -13,6 +13,11 @@ import pytest +from chia._tests.conftest import HarvesterFarmerEnvironment +from chia._tests.plot_sync.test_delta import dummy_plot +from chia._tests.util.misc import assert_rpc_error +from chia._tests.util.rpc import validate_get_routes +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval from chia.consensus.coinbase import create_puzzlehash_for_pk from chia.farmer.farmer import Farmer from chia.plot_sync.receiver import Receiver @@ -35,11 +40,6 @@ from chia.util.ints import uint8, uint32, uint64 from chia.util.misc import get_list_or_len from chia.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened -from tests.conftest import HarvesterFarmerEnvironment -from tests.plot_sync.test_delta import dummy_plot -from tests.util.misc import assert_rpc_error -from tests.util.rpc import validate_get_routes -from tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval log = logging.getLogger(__name__) diff --git a/tests/core/test_filter.py b/chia/_tests/core/test_filter.py similarity index 100% rename from tests/core/test_filter.py rename to chia/_tests/core/test_filter.py diff --git a/tests/core/test_full_node_rpc.py b/chia/_tests/core/test_full_node_rpc.py similarity index 99% rename from tests/core/test_full_node_rpc.py rename to chia/_tests/core/test_full_node_rpc.py index badd01210a5c..6c83faaba630 100644 --- a/tests/core/test_full_node_rpc.py +++ b/chia/_tests/core/test_full_node_rpc.py @@ -7,6 +7,11 @@ from chia_rs import AugSchemeMPL from clvm.casts import int_to_bytes +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block +from chia._tests.conftest import ConsensusMode +from chia._tests.connection_utils import connect_and_get_peer +from chia._tests.util.rpc import validate_get_routes +from chia._tests.util.time_out_assert import time_out_assert from chia.consensus.block_record import BlockRecord from chia.consensus.pot_iterations import is_overflow_block from chia.full_node.signage_point import SignagePoint @@ -28,11 +33,6 @@ from chia.types.unfinished_block import UnfinishedBlock from chia.util.hash import std_hash from chia.util.ints import uint8 -from tests.blockchain.blockchain_test_utils import _validate_and_add_block -from tests.conftest import ConsensusMode -from tests.connection_utils import connect_and_get_peer -from tests.util.rpc import validate_get_routes -from tests.util.time_out_assert import time_out_assert @pytest.mark.anyio diff --git a/tests/core/test_merkle_set.py b/chia/_tests/core/test_merkle_set.py similarity index 100% rename from tests/core/test_merkle_set.py rename to chia/_tests/core/test_merkle_set.py diff --git a/tests/core/test_program.py b/chia/_tests/core/test_program.py similarity index 100% rename from tests/core/test_program.py rename to chia/_tests/core/test_program.py diff --git a/tests/core/test_rpc_util.py b/chia/_tests/core/test_rpc_util.py similarity index 100% rename from tests/core/test_rpc_util.py rename to chia/_tests/core/test_rpc_util.py diff --git a/tests/core/test_seeder.py b/chia/_tests/core/test_seeder.py similarity index 99% rename from tests/core/test_seeder.py rename to chia/_tests/core/test_seeder.py index e355b7e6a7ba..a74d4a709e59 100644 --- a/tests/core/test_seeder.py +++ b/chia/_tests/core/test_seeder.py @@ -9,10 +9,10 @@ import dns import pytest +from chia._tests.util.time_out_assert import time_out_assert from chia.seeder.dns_server import DNSServer from chia.seeder.peer_record import PeerRecord, PeerReliability from chia.util.ints import uint32, uint64 -from tests.util.time_out_assert import time_out_assert timeout = 0.5 diff --git a/tests/core/test_setproctitle.py b/chia/_tests/core/test_setproctitle.py similarity index 100% rename from tests/core/test_setproctitle.py rename to chia/_tests/core/test_setproctitle.py diff --git a/tests/core/util/__init__.py b/chia/_tests/core/util/__init__.py similarity index 100% rename from tests/core/util/__init__.py rename to chia/_tests/core/util/__init__.py diff --git a/tests/core/util/config.py b/chia/_tests/core/util/config.py similarity index 100% rename from tests/core/util/config.py rename to chia/_tests/core/util/config.py diff --git a/tests/core/util/test_cached_bls.py b/chia/_tests/core/util/test_cached_bls.py similarity index 100% rename from tests/core/util/test_cached_bls.py rename to chia/_tests/core/util/test_cached_bls.py diff --git a/tests/core/util/test_config.py b/chia/_tests/core/util/test_config.py similarity index 100% rename from tests/core/util/test_config.py rename to chia/_tests/core/util/test_config.py diff --git a/tests/core/util/test_file_keyring_synchronization.py b/chia/_tests/core/util/test_file_keyring_synchronization.py similarity index 98% rename from tests/core/util/test_file_keyring_synchronization.py rename to chia/_tests/core/util/test_file_keyring_synchronization.py index 2efb89fe9c5d..610c41c14c8b 100644 --- a/tests/core/util/test_file_keyring_synchronization.py +++ b/chia/_tests/core/util/test_file_keyring_synchronization.py @@ -8,10 +8,10 @@ from sys import platform from time import sleep +from chia._tests.core.util.test_lockfile import wait_for_enough_files_in_directory from chia.simulator.keyring import TempKeyring from chia.util.keyring_wrapper import KeyringWrapper from chia.util.timing import adjusted_timeout -from tests.core.util.test_lockfile import wait_for_enough_files_in_directory log = logging.getLogger(__name__) diff --git a/tests/core/util/test_files.py b/chia/_tests/core/util/test_files.py similarity index 100% rename from tests/core/util/test_files.py rename to chia/_tests/core/util/test_files.py diff --git a/tests/core/util/test_jsonify.py b/chia/_tests/core/util/test_jsonify.py similarity index 100% rename from tests/core/util/test_jsonify.py rename to chia/_tests/core/util/test_jsonify.py diff --git a/tests/core/util/test_keychain.py b/chia/_tests/core/util/test_keychain.py similarity index 100% rename from tests/core/util/test_keychain.py rename to chia/_tests/core/util/test_keychain.py diff --git a/tests/core/util/test_keyring_wrapper.py b/chia/_tests/core/util/test_keyring_wrapper.py similarity index 100% rename from tests/core/util/test_keyring_wrapper.py rename to chia/_tests/core/util/test_keyring_wrapper.py diff --git a/tests/core/util/test_lockfile.py b/chia/_tests/core/util/test_lockfile.py similarity index 100% rename from tests/core/util/test_lockfile.py rename to chia/_tests/core/util/test_lockfile.py diff --git a/tests/core/util/test_log_exceptions.py b/chia/_tests/core/util/test_log_exceptions.py similarity index 100% rename from tests/core/util/test_log_exceptions.py rename to chia/_tests/core/util/test_log_exceptions.py diff --git a/tests/core/util/test_lru_cache.py b/chia/_tests/core/util/test_lru_cache.py similarity index 100% rename from tests/core/util/test_lru_cache.py rename to chia/_tests/core/util/test_lru_cache.py diff --git a/tests/core/util/test_significant_bits.py b/chia/_tests/core/util/test_significant_bits.py similarity index 100% rename from tests/core/util/test_significant_bits.py rename to chia/_tests/core/util/test_significant_bits.py diff --git a/tests/core/util/test_streamable.py b/chia/_tests/core/util/test_streamable.py similarity index 100% rename from tests/core/util/test_streamable.py rename to chia/_tests/core/util/test_streamable.py diff --git a/tests/db/__init__.py b/chia/_tests/db/__init__.py similarity index 100% rename from tests/db/__init__.py rename to chia/_tests/db/__init__.py diff --git a/tests/db/test_db_wrapper.py b/chia/_tests/db/test_db_wrapper.py similarity index 99% rename from tests/db/test_db_wrapper.py rename to chia/_tests/db/test_db_wrapper.py index 7b9a6526875b..5611b3779bb9 100644 --- a/tests/db/test_db_wrapper.py +++ b/chia/_tests/db/test_db_wrapper.py @@ -10,8 +10,8 @@ # TODO: update after resolution in https://github.com/pytest-dev/pytest/issues/7469 from _pytest.fixtures import SubRequest +from chia._tests.util.db_connection import DBConnection, PathDBConnection from chia.util.db_wrapper import DBWrapper2 -from tests.util.db_connection import DBConnection, PathDBConnection if TYPE_CHECKING: ConnectionContextManager = contextlib.AbstractAsyncContextManager[aiosqlite.core.Connection] diff --git a/tests/environments/__init__.py b/chia/_tests/environments/__init__.py similarity index 100% rename from tests/environments/__init__.py rename to chia/_tests/environments/__init__.py diff --git a/tests/environments/common.py b/chia/_tests/environments/common.py similarity index 100% rename from tests/environments/common.py rename to chia/_tests/environments/common.py diff --git a/tests/environments/full_node.py b/chia/_tests/environments/full_node.py similarity index 95% rename from tests/environments/full_node.py rename to chia/_tests/environments/full_node.py index e92f0c4e1f12..09a6960bd111 100644 --- a/tests/environments/full_node.py +++ b/chia/_tests/environments/full_node.py @@ -3,13 +3,13 @@ from dataclasses import dataclass from typing import TYPE_CHECKING, ClassVar, Tuple, cast +from chia._tests.environments.common import ServiceEnvironment from chia.full_node.full_node import FullNode from chia.rpc.rpc_server import RpcServer from chia.server.server import ChiaServer from chia.server.start_service import Service from chia.simulator.full_node_simulator import FullNodeSimulator from chia.simulator.simulator_full_node_rpc_api import SimulatorFullNodeRpcApi -from tests.environments.common import ServiceEnvironment @dataclass diff --git a/tests/environments/wallet.py b/chia/_tests/environments/wallet.py similarity index 99% rename from tests/environments/wallet.py rename to chia/_tests/environments/wallet.py index c34109f0c186..d3fcaadcef78 100644 --- a/tests/environments/wallet.py +++ b/chia/_tests/environments/wallet.py @@ -5,6 +5,7 @@ from dataclasses import asdict, dataclass, field from typing import TYPE_CHECKING, ClassVar, Dict, List, Optional, Tuple, Union, cast +from chia._tests.environments.common import ServiceEnvironment from chia.rpc.rpc_server import RpcServer from chia.rpc.wallet_rpc_api import WalletRpcApi from chia.rpc.wallet_rpc_client import WalletRpcClient @@ -19,7 +20,6 @@ from chia.wallet.wallet_node import Balance, WalletNode from chia.wallet.wallet_node_api import WalletNodeAPI from chia.wallet.wallet_state_manager import WalletStateManager -from tests.environments.common import ServiceEnvironment OPP_DICT = {"<": operator.lt, ">": operator.gt, "<=": operator.le, ">=": operator.ge} diff --git a/tests/farmer_harvester/__init__.py b/chia/_tests/farmer_harvester/__init__.py similarity index 100% rename from tests/farmer_harvester/__init__.py rename to chia/_tests/farmer_harvester/__init__.py diff --git a/tests/farmer_harvester/config.py b/chia/_tests/farmer_harvester/config.py similarity index 100% rename from tests/farmer_harvester/config.py rename to chia/_tests/farmer_harvester/config.py diff --git a/tests/farmer_harvester/test_farmer.py b/chia/_tests/farmer_harvester/test_farmer.py similarity index 99% rename from tests/farmer_harvester/test_farmer.py rename to chia/_tests/farmer_harvester/test_farmer.py index 2b3c657680e1..e9c8625ab4c0 100644 --- a/tests/farmer_harvester/test_farmer.py +++ b/chia/_tests/farmer_harvester/test_farmer.py @@ -11,6 +11,8 @@ from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey from pytest_mock import MockerFixture +from chia._tests.conftest import HarvesterFarmerEnvironment +from chia._tests.util.misc import Marks, datacases from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.farmer.farmer import Farmer, increment_pool_stats, strip_old_entries from chia.pools.pool_config import PoolWalletConfig @@ -28,8 +30,6 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.hash import std_hash from chia.util.ints import uint8, uint16, uint32, uint64 -from tests.conftest import HarvesterFarmerEnvironment -from tests.util.misc import Marks, datacases log = logging.getLogger(__name__) diff --git a/tests/farmer_harvester/test_farmer_harvester.py b/chia/_tests/farmer_harvester/test_farmer_harvester.py similarity index 99% rename from tests/farmer_harvester/test_farmer_harvester.py rename to chia/_tests/farmer_harvester/test_farmer_harvester.py index 6fb3905359ab..2ec92dd4a8fe 100644 --- a/tests/farmer_harvester/test_farmer_harvester.py +++ b/chia/_tests/farmer_harvester/test_farmer_harvester.py @@ -8,6 +8,8 @@ import pytest from chia_rs import G1Element +from chia._tests.conftest import HarvesterFarmerEnvironment +from chia._tests.util.time_out_assert import time_out_assert from chia.cmds.cmds_util import get_any_service_client from chia.farmer.farmer import Farmer from chia.plotting.util import PlotsRefreshParameter @@ -24,8 +26,6 @@ from chia.util.ints import uint8, uint32, uint64 from chia.util.keychain import generate_mnemonic from chia.util.misc import split_async_manager -from tests.conftest import HarvesterFarmerEnvironment -from tests.util.time_out_assert import time_out_assert def farmer_is_started(farmer: Farmer) -> bool: diff --git a/tests/farmer_harvester/test_filter_prefix_bits.py b/chia/_tests/farmer_harvester/test_filter_prefix_bits.py similarity index 95% rename from tests/farmer_harvester/test_filter_prefix_bits.py rename to chia/_tests/farmer_harvester/test_filter_prefix_bits.py index c6a228bdffd5..e06f4e559ab7 100644 --- a/tests/farmer_harvester/test_filter_prefix_bits.py +++ b/chia/_tests/farmer_harvester/test_filter_prefix_bits.py @@ -6,6 +6,10 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.core.test_farmer_harvester_rpc import wait_for_plot_sync +from chia._tests.util.setup_nodes import setup_farmer_multi_harvester +from chia._tests.util.time_out_assert import time_out_assert from chia.farmer.farmer_api import FarmerAPI from chia.protocols import farmer_protocol from chia.rpc.farmer_rpc_client import FarmerRpcClient @@ -17,10 +21,6 @@ from chia.types.full_block import FullBlock from chia.util.ints import uint8, uint32, uint64 from chia.util.keychain import Keychain -from tests.conftest import ConsensusMode -from tests.core.test_farmer_harvester_rpc import wait_for_plot_sync -from tests.util.setup_nodes import setup_farmer_multi_harvester -from tests.util.time_out_assert import time_out_assert # these numbers are only valid for chains farmed with the fixed original plot diff --git a/tests/fee_estimation/__init__.py b/chia/_tests/fee_estimation/__init__.py similarity index 100% rename from tests/fee_estimation/__init__.py rename to chia/_tests/fee_estimation/__init__.py diff --git a/tests/fee_estimation/cmdline_test.py b/chia/_tests/fee_estimation/cmdline_test.py similarity index 100% rename from tests/fee_estimation/cmdline_test.py rename to chia/_tests/fee_estimation/cmdline_test.py diff --git a/tests/fee_estimation/config.py b/chia/_tests/fee_estimation/config.py similarity index 100% rename from tests/fee_estimation/config.py rename to chia/_tests/fee_estimation/config.py diff --git a/tests/fee_estimation/test_fee_estimation_integration.py b/chia/_tests/fee_estimation/test_fee_estimation_integration.py similarity index 99% rename from tests/fee_estimation/test_fee_estimation_integration.py rename to chia/_tests/fee_estimation/test_fee_estimation_integration.py index 4292d88ebb8d..3edd6054943e 100644 --- a/tests/fee_estimation/test_fee_estimation_integration.py +++ b/chia/_tests/fee_estimation/test_fee_estimation_integration.py @@ -6,6 +6,11 @@ import pytest from chia_rs import Coin +from chia._tests.core.mempool.test_mempool_manager import ( + create_test_block_record, + instantiate_mempool_manager, + zero_calls_get_coin_records, +) from chia.consensus.cost_calculator import NPCResult from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator from chia.full_node.fee_estimation import ( @@ -26,11 +31,6 @@ from chia.types.mempool_item import MempoolItem from chia.types.spend_bundle_conditions import Spend, SpendBundleConditions from chia.util.ints import uint32, uint64 -from tests.core.mempool.test_mempool_manager import ( - create_test_block_record, - instantiate_mempool_manager, - zero_calls_get_coin_records, -) def make_mempoolitem() -> MempoolItem: diff --git a/tests/fee_estimation/test_fee_estimation_rpc.py b/chia/_tests/fee_estimation/test_fee_estimation_rpc.py similarity index 100% rename from tests/fee_estimation/test_fee_estimation_rpc.py rename to chia/_tests/fee_estimation/test_fee_estimation_rpc.py diff --git a/tests/fee_estimation/test_fee_estimation_unit_tests.py b/chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py similarity index 100% rename from tests/fee_estimation/test_fee_estimation_unit_tests.py rename to chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py diff --git a/tests/fee_estimation/test_mempoolitem_height_added.py b/chia/_tests/fee_estimation/test_mempoolitem_height_added.py similarity index 100% rename from tests/fee_estimation/test_mempoolitem_height_added.py rename to chia/_tests/fee_estimation/test_mempoolitem_height_added.py diff --git a/tests/generator/__init__.py b/chia/_tests/generator/__init__.py similarity index 100% rename from tests/generator/__init__.py rename to chia/_tests/generator/__init__.py diff --git a/tests/generator/puzzles/__init__.py b/chia/_tests/generator/puzzles/__init__.py similarity index 100% rename from tests/generator/puzzles/__init__.py rename to chia/_tests/generator/puzzles/__init__.py diff --git a/tests/generator/puzzles/test_generator_deserialize.clsp b/chia/_tests/generator/puzzles/test_generator_deserialize.clsp similarity index 100% rename from tests/generator/puzzles/test_generator_deserialize.clsp rename to chia/_tests/generator/puzzles/test_generator_deserialize.clsp diff --git a/tests/generator/puzzles/test_generator_deserialize.clsp.hex b/chia/_tests/generator/puzzles/test_generator_deserialize.clsp.hex similarity index 100% rename from tests/generator/puzzles/test_generator_deserialize.clsp.hex rename to chia/_tests/generator/puzzles/test_generator_deserialize.clsp.hex diff --git a/tests/generator/puzzles/test_multiple_generator_input_arguments.clsp b/chia/_tests/generator/puzzles/test_multiple_generator_input_arguments.clsp similarity index 100% rename from tests/generator/puzzles/test_multiple_generator_input_arguments.clsp rename to chia/_tests/generator/puzzles/test_multiple_generator_input_arguments.clsp diff --git a/tests/generator/puzzles/test_multiple_generator_input_arguments.clsp.hex b/chia/_tests/generator/puzzles/test_multiple_generator_input_arguments.clsp.hex similarity index 100% rename from tests/generator/puzzles/test_multiple_generator_input_arguments.clsp.hex rename to chia/_tests/generator/puzzles/test_multiple_generator_input_arguments.clsp.hex diff --git a/tests/generator/test_compression.py b/chia/_tests/generator/test_compression.py similarity index 99% rename from tests/generator/test_compression.py rename to chia/_tests/generator/test_compression.py index 9c798e269151..6c6b9f3c54f4 100644 --- a/tests/generator/test_compression.py +++ b/chia/_tests/generator/test_compression.py @@ -11,6 +11,8 @@ from clvm.serialize import sexp_from_stream from clvm_tools import binutils +from chia._tests.core.make_block_generator import make_spend_bundle +from chia._tests.generator.test_rom import run_generator from chia.full_node.bundle_tools import ( bundle_suitable_for_compression, compressed_coin_spend_entry_list, @@ -28,8 +30,6 @@ from chia.util.byte_types import hexstr_to_bytes from chia.util.ints import uint32 from chia.wallet.puzzles.load_clvm import load_clvm -from tests.core.make_block_generator import make_spend_bundle -from tests.generator.test_rom import run_generator TEST_GEN_DESERIALIZE = load_clvm( "test_generator_deserialize.clsp", package_or_requirement="chia._tests.generator.puzzles" diff --git a/tests/generator/test_generator_types.py b/chia/_tests/generator/test_generator_types.py similarity index 100% rename from tests/generator/test_generator_types.py rename to chia/_tests/generator/test_generator_types.py diff --git a/tests/generator/test_rom.py b/chia/_tests/generator/test_rom.py similarity index 100% rename from tests/generator/test_rom.py rename to chia/_tests/generator/test_rom.py diff --git a/tests/generator/test_scan.py b/chia/_tests/generator/test_scan.py similarity index 100% rename from tests/generator/test_scan.py rename to chia/_tests/generator/test_scan.py diff --git a/tests/plot_sync/__init__.py b/chia/_tests/plot_sync/__init__.py similarity index 100% rename from tests/plot_sync/__init__.py rename to chia/_tests/plot_sync/__init__.py diff --git a/tests/plot_sync/config.py b/chia/_tests/plot_sync/config.py similarity index 100% rename from tests/plot_sync/config.py rename to chia/_tests/plot_sync/config.py diff --git a/tests/plot_sync/test_delta.py b/chia/_tests/plot_sync/test_delta.py similarity index 100% rename from tests/plot_sync/test_delta.py rename to chia/_tests/plot_sync/test_delta.py diff --git a/tests/plot_sync/test_plot_sync.py b/chia/_tests/plot_sync/test_plot_sync.py similarity index 99% rename from tests/plot_sync/test_plot_sync.py rename to chia/_tests/plot_sync/test_plot_sync.py index 6bc43fa668b6..abae83a2686d 100644 --- a/tests/plot_sync/test_plot_sync.py +++ b/chia/_tests/plot_sync/test_plot_sync.py @@ -11,6 +11,10 @@ import pytest from chia_rs import G1Element +from chia._tests.plot_sync.util import start_harvester_service +from chia._tests.plotting.test_plot_manager import Directory, MockPlotInfo +from chia._tests.plotting.util import get_test_plots +from chia._tests.util.time_out_assert import time_out_assert from chia.farmer.farmer import Farmer from chia.harvester.harvester import Harvester from chia.plot_sync.delta import Delta, PathListDelta, PlotListDelta @@ -28,10 +32,6 @@ from chia.util.ints import uint8, uint32, uint64 from chia.util.misc import SplitAsyncManager, split_async_manager from chia.util.streamable import _T_Streamable -from tests.plot_sync.util import start_harvester_service -from tests.plotting.test_plot_manager import Directory, MockPlotInfo -from tests.plotting.util import get_test_plots -from tests.util.time_out_assert import time_out_assert def synced(sender: Sender, receiver: Receiver, previous_last_sync_id: int) -> bool: diff --git a/tests/plot_sync/test_receiver.py b/chia/_tests/plot_sync/test_receiver.py similarity index 99% rename from tests/plot_sync/test_receiver.py rename to chia/_tests/plot_sync/test_receiver.py index f499b95e3d06..ef20b6c5d715 100644 --- a/tests/plot_sync/test_receiver.py +++ b/chia/_tests/plot_sync/test_receiver.py @@ -9,6 +9,7 @@ import pytest from chia_rs import G1Element +from chia._tests.plot_sync.util import get_dummy_connection from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size from chia.plot_sync.delta import Delta from chia.plot_sync.receiver import Receiver, Sync @@ -28,7 +29,6 @@ from chia.util.ints import uint8, uint32, uint64 from chia.util.misc import get_list_or_len from chia.util.streamable import _T_Streamable -from tests.plot_sync.util import get_dummy_connection log = logging.getLogger(__name__) diff --git a/tests/plot_sync/test_sender.py b/chia/_tests/plot_sync/test_sender.py similarity index 98% rename from tests/plot_sync/test_sender.py rename to chia/_tests/plot_sync/test_sender.py index 1323e2208fa8..07b7d1575510 100644 --- a/tests/plot_sync/test_sender.py +++ b/chia/_tests/plot_sync/test_sender.py @@ -4,6 +4,7 @@ import pytest +from chia._tests.plot_sync.util import get_dummy_connection, plot_sync_identifier from chia.plot_sync.exceptions import AlreadyStartedError, InvalidConnectionTypeError from chia.plot_sync.sender import ExpectedResponse, Sender from chia.plot_sync.util import Constants @@ -14,7 +15,6 @@ from chia.simulator.block_tools import BlockTools from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import int16, uint64 -from tests.plot_sync.util import get_dummy_connection, plot_sync_identifier def test_default_values(bt: BlockTools) -> None: diff --git a/tests/plot_sync/test_sync_simulated.py b/chia/_tests/plot_sync/test_sync_simulated.py similarity index 99% rename from tests/plot_sync/test_sync_simulated.py rename to chia/_tests/plot_sync/test_sync_simulated.py index 5913ee78eb55..82b2c4cd9705 100644 --- a/tests/plot_sync/test_sync_simulated.py +++ b/chia/_tests/plot_sync/test_sync_simulated.py @@ -14,6 +14,8 @@ import pytest from chia_rs import G1Element +from chia._tests.plot_sync.util import start_harvester_service +from chia._tests.util.time_out_assert import time_out_assert from chia.farmer.farmer import Farmer from chia.harvester.harvester import Harvester from chia.plot_sync.receiver import Receiver @@ -30,8 +32,6 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import int16, uint8, uint64 from chia.util.misc import to_batches -from tests.plot_sync.util import start_harvester_service -from tests.util.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/plot_sync/util.py b/chia/_tests/plot_sync/util.py similarity index 97% rename from tests/plot_sync/util.py rename to chia/_tests/plot_sync/util.py index 4c91f23b1b17..f88cdbc9fdbf 100644 --- a/tests/plot_sync/util.py +++ b/chia/_tests/plot_sync/util.py @@ -5,6 +5,7 @@ from dataclasses import dataclass from typing import AsyncIterator, Optional +from chia._tests.util.time_out_assert import time_out_assert from chia.harvester.harvester import Harvester from chia.plot_sync.sender import Sender from chia.protocols.harvester_protocol import PlotSyncIdentifier @@ -14,7 +15,6 @@ from chia.types.peer_info import PeerInfo, UnresolvedPeerInfo from chia.util.ints import uint16, uint64 from chia.util.misc import SplitAsyncManager, split_async_manager -from tests.util.time_out_assert import time_out_assert @dataclass diff --git a/tests/plotting/__init__.py b/chia/_tests/plotting/__init__.py similarity index 100% rename from tests/plotting/__init__.py rename to chia/_tests/plotting/__init__.py diff --git a/tests/plotting/config.py b/chia/_tests/plotting/config.py similarity index 100% rename from tests/plotting/config.py rename to chia/_tests/plotting/config.py diff --git a/tests/plotting/test_plot_manager.py b/chia/_tests/plotting/test_plot_manager.py similarity index 99% rename from tests/plotting/test_plot_manager.py rename to chia/_tests/plotting/test_plot_manager.py index d78e5c1bb069..db623536f469 100644 --- a/tests/plotting/test_plot_manager.py +++ b/chia/_tests/plotting/test_plot_manager.py @@ -12,6 +12,8 @@ import pytest from chia_rs import G1Element +from chia._tests.plotting.util import get_test_plots +from chia._tests.util.time_out_assert import time_out_assert from chia.plotting.cache import CURRENT_VERSION, CacheDataV1 from chia.plotting.manager import Cache, PlotManager from chia.plotting.util import ( @@ -27,8 +29,6 @@ from chia.util.config import create_default_chia_config, lock_and_load_config, save_config from chia.util.ints import uint16, uint32 from chia.util.misc import VersionedBlob -from tests.plotting.util import get_test_plots -from tests.util.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/plotting/util.py b/chia/_tests/plotting/util.py similarity index 100% rename from tests/plotting/util.py rename to chia/_tests/plotting/util.py diff --git a/tests/pools/__init__.py b/chia/_tests/pools/__init__.py similarity index 100% rename from tests/pools/__init__.py rename to chia/_tests/pools/__init__.py diff --git a/tests/pools/config.py b/chia/_tests/pools/config.py similarity index 100% rename from tests/pools/config.py rename to chia/_tests/pools/config.py diff --git a/tests/pools/test_pool_cmdline.py b/chia/_tests/pools/test_pool_cmdline.py similarity index 100% rename from tests/pools/test_pool_cmdline.py rename to chia/_tests/pools/test_pool_cmdline.py diff --git a/tests/pools/test_pool_config.py b/chia/_tests/pools/test_pool_config.py similarity index 100% rename from tests/pools/test_pool_config.py rename to chia/_tests/pools/test_pool_config.py diff --git a/tests/pools/test_pool_puzzles_lifecycle.py b/chia/_tests/pools/test_pool_puzzles_lifecycle.py similarity index 98% rename from tests/pools/test_pool_puzzles_lifecycle.py rename to chia/_tests/pools/test_pool_puzzles_lifecycle.py index e6df7c8f39a6..1c9f5d417017 100644 --- a/tests/pools/test_pool_puzzles_lifecycle.py +++ b/chia/_tests/pools/test_pool_puzzles_lifecycle.py @@ -7,6 +7,9 @@ import pytest from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey +from chia._tests.clvm.coin_store import BadSpendBundleError, CoinStore, CoinTimestamp +from chia._tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index +from chia._tests.util.key_tool import KeyTool from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.pools.pool_puzzles import ( SINGLETON_MOD_HASH, @@ -39,9 +42,6 @@ solution_for_conditions, ) from chia.wallet.singleton import get_most_recent_singleton_coin_from_coin_spend -from tests.clvm.coin_store import BadSpendBundleError, CoinStore, CoinTimestamp -from tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index -from tests.util.key_tool import KeyTool """ This test suite aims to test: diff --git a/tests/pools/test_pool_rpc.py b/chia/_tests/pools/test_pool_rpc.py similarity index 99% rename from tests/pools/test_pool_rpc.py rename to chia/_tests/pools/test_pool_rpc.py index 716918d798ce..c72d2c8d8916 100644 --- a/tests/pools/test_pool_rpc.py +++ b/chia/_tests/pools/test_pool_rpc.py @@ -15,6 +15,8 @@ from _pytest.fixtures import SubRequest from chia_rs import G1Element +from chia._tests.util.setup_nodes import setup_simulators_and_wallets_service +from chia._tests.util.time_out_assert import time_out_assert from chia.consensus.constants import ConsensusConstants from chia.pools.pool_puzzles import SINGLETON_LAUNCHER_HASH from chia.pools.pool_wallet_info import PoolSingletonState, PoolWalletInfo @@ -34,8 +36,6 @@ from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet_node import WalletNode -from tests.util.setup_nodes import setup_simulators_and_wallets_service -from tests.util.time_out_assert import time_out_assert # TODO: Compare deducted fees in all tests against reported total_fee diff --git a/tests/pools/test_pool_wallet.py b/chia/_tests/pools/test_pool_wallet.py similarity index 99% rename from tests/pools/test_pool_wallet.py rename to chia/_tests/pools/test_pool_wallet.py index 252d889dec26..e2d45a9db7ed 100644 --- a/tests/pools/test_pool_wallet.py +++ b/chia/_tests/pools/test_pool_wallet.py @@ -8,9 +8,9 @@ import pytest from chia_rs import G1Element +from chia._tests.util.benchmarks import rand_g1, rand_hash from chia.pools.pool_wallet import PoolWallet from chia.types.blockchain_format.sized_bytes import bytes32 -from tests.util.benchmarks import rand_g1, rand_hash @dataclass diff --git a/tests/pools/test_wallet_pool_store.py b/chia/_tests/pools/test_wallet_pool_store.py similarity index 99% rename from tests/pools/test_wallet_pool_store.py rename to chia/_tests/pools/test_wallet_pool_store.py index 814c975e702b..88c971cb11cd 100644 --- a/tests/pools/test_wallet_pool_store.py +++ b/chia/_tests/pools/test_wallet_pool_store.py @@ -7,6 +7,7 @@ import pytest from clvm_tools import binutils +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program from chia.types.blockchain_format.serialized_program import SerializedProgram @@ -14,7 +15,6 @@ from chia.types.coin_spend import CoinSpend, compute_additions, make_spend from chia.util.ints import uint32, uint64 from chia.wallet.wallet_pool_store import WalletPoolStore -from tests.util.db_connection import DBConnection def make_child_solution( diff --git a/tests/process_benchmarks.py b/chia/_tests/process_benchmarks.py similarity index 100% rename from tests/process_benchmarks.py rename to chia/_tests/process_benchmarks.py diff --git a/tests/simulation/__init__.py b/chia/_tests/simulation/__init__.py similarity index 100% rename from tests/simulation/__init__.py rename to chia/_tests/simulation/__init__.py diff --git a/tests/simulation/config.py b/chia/_tests/simulation/config.py similarity index 100% rename from tests/simulation/config.py rename to chia/_tests/simulation/config.py diff --git a/tests/simulation/test_simulation.py b/chia/_tests/simulation/test_simulation.py similarity index 99% rename from tests/simulation/test_simulation.py rename to chia/_tests/simulation/test_simulation.py index 4e235f9e8f04..a995121e2afe 100644 --- a/tests/simulation/test_simulation.py +++ b/chia/_tests/simulation/test_simulation.py @@ -8,6 +8,9 @@ import pkg_resources import pytest +from chia._tests.core.node_height import node_height_at_least +from chia._tests.util.setup_nodes import FullSystem, OldSimulatorsAndWallets +from chia._tests.util.time_out_assert import time_out_assert from chia.cmds.units import units from chia.consensus.block_record import BlockRecord from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward @@ -27,9 +30,6 @@ from chia.util.ws_message import create_payload from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.wallet_node import WalletNode -from tests.core.node_height import node_height_at_least -from tests.util.setup_nodes import FullSystem, OldSimulatorsAndWallets -from tests.util.time_out_assert import time_out_assert chiapos_version = pkg_resources.get_distribution("chiapos").version diff --git a/tests/simulation/test_simulator.py b/chia/_tests/simulation/test_simulator.py similarity index 99% rename from tests/simulation/test_simulator.py rename to chia/_tests/simulation/test_simulator.py index 41a3a7146817..c27512d6f0f2 100644 --- a/tests/simulation/test_simulator.py +++ b/chia/_tests/simulation/test_simulator.py @@ -4,6 +4,7 @@ import pytest +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets from chia.cmds.units import units from chia.server.server import ChiaServer from chia.simulator.block_tools import BlockTools @@ -12,7 +13,6 @@ from chia.util.ints import uint64 from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.wallet_node import WalletNode -from tests.util.setup_nodes import OldSimulatorsAndWallets @pytest.mark.anyio diff --git a/tests/simulation/test_start_simulator.py b/chia/_tests/simulation/test_start_simulator.py similarity index 98% rename from tests/simulation/test_start_simulator.py rename to chia/_tests/simulation/test_start_simulator.py index eb7a156466b3..f04782f95848 100644 --- a/tests/simulation/test_start_simulator.py +++ b/chia/_tests/simulation/test_start_simulator.py @@ -6,6 +6,7 @@ import pytest +from chia._tests.util.time_out_assert import time_out_assert from chia.simulator.full_node_simulator import FullNodeSimulator from chia.simulator.simulator_full_node_rpc_client import SimulatorFullNodeRpcClient from chia.simulator.simulator_test_tools import get_full_chia_simulator, get_puzzle_hash_from_key @@ -13,7 +14,6 @@ from chia.util.hash import std_hash from chia.util.ints import uint16 from chia.util.keychain import Keychain -from tests.util.time_out_assert import time_out_assert async def get_num_coins_for_ph(simulator_client: SimulatorFullNodeRpcClient, ph: bytes32) -> int: diff --git a/tests/testconfig.py b/chia/_tests/testconfig.py similarity index 100% rename from tests/testconfig.py rename to chia/_tests/testconfig.py diff --git a/tests/timelord/__init__.py b/chia/_tests/timelord/__init__.py similarity index 100% rename from tests/timelord/__init__.py rename to chia/_tests/timelord/__init__.py diff --git a/tests/timelord/config.py b/chia/_tests/timelord/config.py similarity index 100% rename from tests/timelord/config.py rename to chia/_tests/timelord/config.py diff --git a/tests/timelord/test_new_peak.py b/chia/_tests/timelord/test_new_peak.py similarity index 98% rename from tests/timelord/test_new_peak.py rename to chia/_tests/timelord/test_new_peak.py index b372285813eb..6409828ff1ce 100644 --- a/tests/timelord/test_new_peak.py +++ b/chia/_tests/timelord/test_new_peak.py @@ -4,6 +4,8 @@ import pytest +from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block +from chia._tests.util.blockchain import create_blockchain from chia.consensus.block_record import BlockRecord from chia.consensus.blockchain_interface import BlockchainInterface from chia.consensus.constants import ConsensusConstants @@ -17,8 +19,6 @@ from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary from chia.types.full_block import FullBlock from chia.util.ints import uint128 -from tests.blockchain.blockchain_test_utils import _validate_and_add_block -from tests.util.blockchain import create_blockchain class TestNewPeak: diff --git a/tests/timelord/test_timelord.py b/chia/_tests/timelord/test_timelord.py similarity index 100% rename from tests/timelord/test_timelord.py rename to chia/_tests/timelord/test_timelord.py diff --git a/tests/tools/1315537.json b/chia/_tests/tools/1315537.json similarity index 100% rename from tests/tools/1315537.json rename to chia/_tests/tools/1315537.json diff --git a/tests/tools/1315544.json b/chia/_tests/tools/1315544.json similarity index 100% rename from tests/tools/1315544.json rename to chia/_tests/tools/1315544.json diff --git a/tests/tools/1315630.json b/chia/_tests/tools/1315630.json similarity index 100% rename from tests/tools/1315630.json rename to chia/_tests/tools/1315630.json diff --git a/tests/tools/300000.json b/chia/_tests/tools/300000.json similarity index 100% rename from tests/tools/300000.json rename to chia/_tests/tools/300000.json diff --git a/tests/tools/442734.json b/chia/_tests/tools/442734.json similarity index 100% rename from tests/tools/442734.json rename to chia/_tests/tools/442734.json diff --git a/tests/tools/466212.json b/chia/_tests/tools/466212.json similarity index 100% rename from tests/tools/466212.json rename to chia/_tests/tools/466212.json diff --git a/tests/tools/__init__.py b/chia/_tests/tools/__init__.py similarity index 100% rename from tests/tools/__init__.py rename to chia/_tests/tools/__init__.py diff --git a/tests/tools/config.py b/chia/_tests/tools/config.py similarity index 100% rename from tests/tools/config.py rename to chia/_tests/tools/config.py diff --git a/tests/tools/test-blockchain-db.sqlite b/chia/_tests/tools/test-blockchain-db.sqlite similarity index 100% rename from tests/tools/test-blockchain-db.sqlite rename to chia/_tests/tools/test-blockchain-db.sqlite diff --git a/tests/tools/test_full_sync.py b/chia/_tests/tools/test_full_sync.py similarity index 92% rename from tests/tools/test_full_sync.py rename to chia/_tests/tools/test_full_sync.py index a48ce9fe4e32..db2e57b076f9 100644 --- a/tests/tools/test_full_sync.py +++ b/chia/_tests/tools/test_full_sync.py @@ -8,7 +8,7 @@ import pytest -from tests.util.full_sync import run_sync_test +from chia._tests.util.full_sync import run_sync_test @pytest.mark.parametrize("keep_up", [True, False]) diff --git a/tests/tools/test_legacy_keyring.py b/chia/_tests/tools/test_legacy_keyring.py similarity index 100% rename from tests/tools/test_legacy_keyring.py rename to chia/_tests/tools/test_legacy_keyring.py diff --git a/tests/tools/test_run_block.py b/chia/_tests/tools/test_run_block.py similarity index 98% rename from tests/tools/test_run_block.py rename to chia/_tests/tools/test_run_block.py index ab4b63928f22..7c0bde86d80f 100644 --- a/tests/tools/test_run_block.py +++ b/chia/_tests/tools/test_run_block.py @@ -5,12 +5,12 @@ from pathlib import Path from typing import List +from chia._tests.util.run_block import run_json_block from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.condition_opcodes import ConditionOpcode from chia.types.condition_with_args import ConditionWithArgs from chia.util.ints import uint32, uint64, uint128 -from tests.util.run_block import run_json_block constants = dataclasses.replace( DEFAULT_CONSTANTS, diff --git a/tests/util/__init__.py b/chia/_tests/util/__init__.py similarity index 100% rename from tests/util/__init__.py rename to chia/_tests/util/__init__.py diff --git a/tests/util/benchmark_cost.py b/chia/_tests/util/benchmark_cost.py similarity index 100% rename from tests/util/benchmark_cost.py rename to chia/_tests/util/benchmark_cost.py diff --git a/tests/util/benchmarks.py b/chia/_tests/util/benchmarks.py similarity index 100% rename from tests/util/benchmarks.py rename to chia/_tests/util/benchmarks.py diff --git a/tests/util/bip39_test_vectors.json b/chia/_tests/util/bip39_test_vectors.json similarity index 100% rename from tests/util/bip39_test_vectors.json rename to chia/_tests/util/bip39_test_vectors.json diff --git a/tests/util/blockchain.py b/chia/_tests/util/blockchain.py similarity index 100% rename from tests/util/blockchain.py rename to chia/_tests/util/blockchain.py diff --git a/tests/util/build_network_protocol_files.py b/chia/_tests/util/build_network_protocol_files.py similarity index 95% rename from tests/util/build_network_protocol_files.py rename to chia/_tests/util/build_network_protocol_files.py index c520397b0b12..0e81f81835e1 100644 --- a/tests/util/build_network_protocol_files.py +++ b/chia/_tests/util/build_network_protocol_files.py @@ -6,8 +6,8 @@ from pathlib import Path from typing import Any, Callable +from chia._tests.util.network_protocol_data import * # noqa: F403 from chia.util.ints import uint32 -from tests.util.network_protocol_data import * # noqa: F403 version = "1.0" @@ -175,9 +175,9 @@ def build_protocol_test() -> str: from pathlib import Path from typing import Tuple -from tests.util.build_network_protocol_files import get_network_protocol_filename -from tests.util.network_protocol_data import * # noqa: F403 -from tests.util.protocol_messages_json import * # noqa: F403 +from chia._tests.util.build_network_protocol_files import get_network_protocol_filename +from chia._tests.util.network_protocol_data import * # noqa: F403 +from chia._tests.util.protocol_messages_json import * # noqa: F403 def parse_blob(input_bytes: bytes) -> Tuple[bytes, bytes]: @@ -241,8 +241,8 @@ def build_json_test() -> str: from __future__ import annotations -from tests.util.network_protocol_data import * # noqa: F403 -from tests.util.protocol_messages_json import * # noqa: F403 +from chia._tests.util.network_protocol_data import * # noqa: F403 +from chia._tests.util.protocol_messages_json import * # noqa: F403 def test_protocol_json() -> None: diff --git a/tests/util/clvm_generator.bin b/chia/_tests/util/clvm_generator.bin similarity index 100% rename from tests/util/clvm_generator.bin rename to chia/_tests/util/clvm_generator.bin diff --git a/tests/util/config.py b/chia/_tests/util/config.py similarity index 100% rename from tests/util/config.py rename to chia/_tests/util/config.py diff --git a/tests/util/constants.py b/chia/_tests/util/constants.py similarity index 100% rename from tests/util/constants.py rename to chia/_tests/util/constants.py diff --git a/tests/util/db_connection.py b/chia/_tests/util/db_connection.py similarity index 100% rename from tests/util/db_connection.py rename to chia/_tests/util/db_connection.py diff --git a/tests/util/full_sync.py b/chia/_tests/util/full_sync.py similarity index 99% rename from tests/util/full_sync.py rename to chia/_tests/util/full_sync.py index 43cb7aeb3afd..11d3ec18df29 100644 --- a/tests/util/full_sync.py +++ b/chia/_tests/util/full_sync.py @@ -12,6 +12,7 @@ import aiosqlite import zstd +from chia._tests.util.constants import test_constants as TEST_CONSTANTS from chia.cmds.init_funcs import chia_init from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.full_node.full_node import FullNode @@ -24,7 +25,6 @@ from chia.types.peer_info import PeerInfo from chia.util.config import load_config from chia.util.ints import uint16 -from tests.util.constants import test_constants as TEST_CONSTANTS class ExitOnError(logging.Handler): diff --git a/tests/util/gen_ssl_certs.py b/chia/_tests/util/gen_ssl_certs.py similarity index 100% rename from tests/util/gen_ssl_certs.py rename to chia/_tests/util/gen_ssl_certs.py diff --git a/tests/util/generator_tools_testing.py b/chia/_tests/util/generator_tools_testing.py similarity index 100% rename from tests/util/generator_tools_testing.py rename to chia/_tests/util/generator_tools_testing.py diff --git a/tests/util/key_tool.py b/chia/_tests/util/key_tool.py similarity index 95% rename from tests/util/key_tool.py rename to chia/_tests/util/key_tool.py index a06e621e4145..0c5dc9919683 100644 --- a/tests/util/key_tool.py +++ b/chia/_tests/util/key_tool.py @@ -5,10 +5,10 @@ from chia_rs import AugSchemeMPL, G2Element, PrivateKey +from chia._tests.core.make_block_generator import GROUP_ORDER, int_to_public_key from chia.simulator.block_tools import test_constants from chia.types.coin_spend import CoinSpend from chia.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict -from tests.core.make_block_generator import GROUP_ORDER, int_to_public_key @dataclass diff --git a/tests/util/misc.py b/chia/_tests/util/misc.py similarity index 99% rename from tests/util/misc.py rename to chia/_tests/util/misc.py index c5b3c23d1996..49f73c095349 100644 --- a/tests/util/misc.py +++ b/chia/_tests/util/misc.py @@ -23,13 +23,13 @@ from typing_extensions import Protocol, final import chia +from chia._tests.core.data_layer.util import ChiaRoot from chia.full_node.mempool import Mempool from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.condition_opcodes import ConditionOpcode from chia.util.hash import std_hash from chia.util.ints import uint64 from chia.wallet.util.compute_hints import HintedCoin -from tests.core.data_layer.util import ChiaRoot class GcMode(enum.Enum): diff --git a/tests/util/network_protocol_data.py b/chia/_tests/util/network_protocol_data.py similarity index 100% rename from tests/util/network_protocol_data.py rename to chia/_tests/util/network_protocol_data.py diff --git a/tests/util/protocol_messages_bytes-v1.0 b/chia/_tests/util/protocol_messages_bytes-v1.0 similarity index 100% rename from tests/util/protocol_messages_bytes-v1.0 rename to chia/_tests/util/protocol_messages_bytes-v1.0 diff --git a/tests/util/protocol_messages_json.py b/chia/_tests/util/protocol_messages_json.py similarity index 100% rename from tests/util/protocol_messages_json.py rename to chia/_tests/util/protocol_messages_json.py diff --git a/tests/util/rpc.py b/chia/_tests/util/rpc.py similarity index 100% rename from tests/util/rpc.py rename to chia/_tests/util/rpc.py diff --git a/tests/util/run_block.py b/chia/_tests/util/run_block.py similarity index 100% rename from tests/util/run_block.py rename to chia/_tests/util/run_block.py diff --git a/tests/util/setup_nodes.py b/chia/_tests/util/setup_nodes.py similarity index 99% rename from tests/util/setup_nodes.py rename to chia/_tests/util/setup_nodes.py index 2d40a701a060..de008c61a688 100644 --- a/tests/util/setup_nodes.py +++ b/chia/_tests/util/setup_nodes.py @@ -10,6 +10,8 @@ import anyio +from chia._tests.environments.full_node import FullNodeEnvironment +from chia._tests.environments.wallet import WalletEnvironment from chia.consensus.constants import ConsensusConstants from chia.daemon.server import WebSocketServer from chia.farmer.farmer import Farmer @@ -49,8 +51,6 @@ from chia.util.keychain import Keychain from chia.util.timing import adjusted_timeout, backoff_times from chia.wallet.wallet_node import WalletNode -from tests.environments.full_node import FullNodeEnvironment -from tests.environments.wallet import WalletEnvironment OldSimulatorsAndWallets = Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools] SimulatorsAndWalletsServices = Tuple[List[SimulatorFullNodeService], List[WalletService], BlockTools] diff --git a/tests/util/temp_file.py b/chia/_tests/util/temp_file.py similarity index 100% rename from tests/util/temp_file.py rename to chia/_tests/util/temp_file.py diff --git a/tests/util/test_build_job_matrix.py b/chia/_tests/util/test_build_job_matrix.py similarity index 100% rename from tests/util/test_build_job_matrix.py rename to chia/_tests/util/test_build_job_matrix.py diff --git a/tests/util/test_build_network_protocol_files.py b/chia/_tests/util/test_build_network_protocol_files.py similarity index 60% rename from tests/util/test_build_network_protocol_files.py rename to chia/_tests/util/test_build_network_protocol_files.py index c22c89073b4b..fed31b83bdd0 100644 --- a/tests/util/test_build_network_protocol_files.py +++ b/chia/_tests/util/test_build_network_protocol_files.py @@ -1,6 +1,6 @@ from __future__ import annotations -from tests.util.build_network_protocol_files import main +from chia._tests.util.build_network_protocol_files import main def test_build_network_protocol_files() -> None: diff --git a/tests/util/test_collection.py b/chia/_tests/util/test_collection.py similarity index 100% rename from tests/util/test_collection.py rename to chia/_tests/util/test_collection.py diff --git a/tests/util/test_condition_tools.py b/chia/_tests/util/test_condition_tools.py similarity index 100% rename from tests/util/test_condition_tools.py rename to chia/_tests/util/test_condition_tools.py diff --git a/tests/util/test_config.py b/chia/_tests/util/test_config.py similarity index 99% rename from tests/util/test_config.py rename to chia/_tests/util/test_config.py index e9491f3c5c74..fe54c1e5d922 100644 --- a/tests/util/test_config.py +++ b/chia/_tests/util/test_config.py @@ -3,11 +3,11 @@ from dataclasses import dataclass from typing import Any, Dict, Optional, Set +from chia._tests.util.misc import DataCase, Marks, datacases from chia.server.outbound_message import NodeType from chia.types.peer_info import UnresolvedPeerInfo from chia.util.config import get_unresolved_peer_infos, set_peer_info from chia.util.ints import uint16 -from tests.util.misc import DataCase, Marks, datacases @dataclass diff --git a/tests/util/test_dump_keyring.py b/chia/_tests/util/test_dump_keyring.py similarity index 96% rename from tests/util/test_dump_keyring.py rename to chia/_tests/util/test_dump_keyring.py index f250816c4b39..f439fa7a645b 100644 --- a/tests/util/test_dump_keyring.py +++ b/chia/_tests/util/test_dump_keyring.py @@ -7,9 +7,9 @@ from click.testing import CliRunner +from chia._tests.util.misc import Marks, datacases from chia.util.dump_keyring import dump from chia.util.keychain import Keychain -from tests.util.misc import Marks, datacases output_prefix = """Attempting to dump contents of keyring file: {path} diff --git a/tests/util/test_errors.py b/chia/_tests/util/test_errors.py similarity index 100% rename from tests/util/test_errors.py rename to chia/_tests/util/test_errors.py diff --git a/tests/util/test_full_block_utils.py b/chia/_tests/util/test_full_block_utils.py similarity index 98% rename from tests/util/test_full_block_utils.py rename to chia/_tests/util/test_full_block_utils.py index 61a19a7c15f4..a7242ac45275 100644 --- a/tests/util/test_full_block_utils.py +++ b/chia/_tests/util/test_full_block_utils.py @@ -6,6 +6,7 @@ import pytest from chia_rs import G1Element, G2Element +from chia._tests.util.benchmarks import rand_bytes, rand_g1, rand_g2, rand_hash, rand_vdf, rand_vdf_proof, rewards from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo from chia.types.blockchain_format.pool_target import PoolTarget from chia.types.blockchain_format.proof_of_space import ProofOfSpace @@ -25,7 +26,6 @@ from chia.util.full_block_utils import block_info_from_block, generator_from_block, header_block_from_block from chia.util.generator_tools import get_block_header from chia.util.ints import uint8, uint32, uint64, uint128 -from tests.util.benchmarks import rand_bytes, rand_g1, rand_g2, rand_hash, rand_vdf, rand_vdf_proof, rewards test_g2s: List[G2Element] = [rand_g2() for _ in range(10)] test_g1s: List[G1Element] = [rand_g1() for _ in range(10)] diff --git a/tests/util/test_limited_semaphore.py b/chia/_tests/util/test_limited_semaphore.py similarity index 100% rename from tests/util/test_limited_semaphore.py rename to chia/_tests/util/test_limited_semaphore.py diff --git a/tests/util/test_logging_filter.py b/chia/_tests/util/test_logging_filter.py similarity index 100% rename from tests/util/test_logging_filter.py rename to chia/_tests/util/test_logging_filter.py diff --git a/tests/util/test_misc.py b/chia/_tests/util/test_misc.py similarity index 100% rename from tests/util/test_misc.py rename to chia/_tests/util/test_misc.py diff --git a/tests/util/test_network.py b/chia/_tests/util/test_network.py similarity index 100% rename from tests/util/test_network.py rename to chia/_tests/util/test_network.py diff --git a/tests/util/test_network_protocol_files.py b/chia/_tests/util/test_network_protocol_files.py similarity index 99% rename from tests/util/test_network_protocol_files.py rename to chia/_tests/util/test_network_protocol_files.py index 2b80661b5152..78429bccf4b3 100644 --- a/tests/util/test_network_protocol_files.py +++ b/chia/_tests/util/test_network_protocol_files.py @@ -5,9 +5,9 @@ from pathlib import Path from typing import Tuple -from tests.util.build_network_protocol_files import get_network_protocol_filename -from tests.util.network_protocol_data import * # noqa: F403 -from tests.util.protocol_messages_json import * # noqa: F403 +from chia._tests.util.build_network_protocol_files import get_network_protocol_filename +from chia._tests.util.network_protocol_data import * # noqa: F403 +from chia._tests.util.protocol_messages_json import * # noqa: F403 def parse_blob(input_bytes: bytes) -> Tuple[bytes, bytes]: diff --git a/tests/util/test_network_protocol_json.py b/chia/_tests/util/test_network_protocol_json.py similarity index 99% rename from tests/util/test_network_protocol_json.py rename to chia/_tests/util/test_network_protocol_json.py index 3f403ad0d79e..688746a9696c 100644 --- a/tests/util/test_network_protocol_json.py +++ b/chia/_tests/util/test_network_protocol_json.py @@ -2,8 +2,8 @@ from __future__ import annotations -from tests.util.network_protocol_data import * # noqa: F403 -from tests.util.protocol_messages_json import * # noqa: F403 +from chia._tests.util.network_protocol_data import * # noqa: F403 +from chia._tests.util.protocol_messages_json import * # noqa: F403 def test_protocol_json() -> None: diff --git a/tests/util/test_network_protocol_test.py b/chia/_tests/util/test_network_protocol_test.py similarity index 100% rename from tests/util/test_network_protocol_test.py rename to chia/_tests/util/test_network_protocol_test.py diff --git a/tests/util/test_paginator.py b/chia/_tests/util/test_paginator.py similarity index 100% rename from tests/util/test_paginator.py rename to chia/_tests/util/test_paginator.py diff --git a/tests/util/test_pprint.py b/chia/_tests/util/test_pprint.py similarity index 100% rename from tests/util/test_pprint.py rename to chia/_tests/util/test_pprint.py diff --git a/tests/util/test_priority_mutex.py b/chia/_tests/util/test_priority_mutex.py similarity index 99% rename from tests/util/test_priority_mutex.py rename to chia/_tests/util/test_priority_mutex.py index e615ab0725f5..d93ecb44f6f6 100644 --- a/tests/util/test_priority_mutex.py +++ b/chia/_tests/util/test_priority_mutex.py @@ -13,10 +13,10 @@ import anyio import pytest +from chia._tests.util.misc import Marks, datacases +from chia._tests.util.time_out_assert import time_out_assert_custom_interval from chia.util.priority_mutex import NestedLockUnsupportedError, PriorityMutex from chia.util.timing import adjusted_timeout -from tests.util.misc import Marks, datacases -from tests.util.time_out_assert import time_out_assert_custom_interval log = logging.getLogger(__name__) diff --git a/tests/util/test_recursive_replace.py b/chia/_tests/util/test_recursive_replace.py similarity index 100% rename from tests/util/test_recursive_replace.py rename to chia/_tests/util/test_recursive_replace.py diff --git a/tests/util/test_ssl_check.py b/chia/_tests/util/test_ssl_check.py similarity index 100% rename from tests/util/test_ssl_check.py rename to chia/_tests/util/test_ssl_check.py diff --git a/tests/util/test_struct_stream.py b/chia/_tests/util/test_struct_stream.py similarity index 100% rename from tests/util/test_struct_stream.py rename to chia/_tests/util/test_struct_stream.py diff --git a/tests/util/test_testnet_overrides.py b/chia/_tests/util/test_testnet_overrides.py similarity index 100% rename from tests/util/test_testnet_overrides.py rename to chia/_tests/util/test_testnet_overrides.py diff --git a/tests/util/test_tests_misc.py b/chia/_tests/util/test_tests_misc.py similarity index 92% rename from tests/util/test_tests_misc.py rename to chia/_tests/util/test_tests_misc.py index 01836b3549ab..e6ee26b5010c 100644 --- a/tests/util/test_tests_misc.py +++ b/chia/_tests/util/test_tests_misc.py @@ -4,7 +4,7 @@ import pytest -from tests.util.misc import Marks, datacases, named_datacases +from chia._tests.util.misc import Marks, datacases, named_datacases @dataclass diff --git a/tests/util/test_timing.py b/chia/_tests/util/test_timing.py similarity index 100% rename from tests/util/test_timing.py rename to chia/_tests/util/test_timing.py diff --git a/tests/util/test_trusted_peer.py b/chia/_tests/util/test_trusted_peer.py similarity index 100% rename from tests/util/test_trusted_peer.py rename to chia/_tests/util/test_trusted_peer.py diff --git a/tests/util/time_out_assert.py b/chia/_tests/util/time_out_assert.py similarity index 100% rename from tests/util/time_out_assert.py rename to chia/_tests/util/time_out_assert.py diff --git a/tests/wallet/__init__.py b/chia/_tests/wallet/__init__.py similarity index 100% rename from tests/wallet/__init__.py rename to chia/_tests/wallet/__init__.py diff --git a/tests/wallet/cat_wallet/__init__.py b/chia/_tests/wallet/cat_wallet/__init__.py similarity index 100% rename from tests/wallet/cat_wallet/__init__.py rename to chia/_tests/wallet/cat_wallet/__init__.py diff --git a/tests/wallet/cat_wallet/config.py b/chia/_tests/wallet/cat_wallet/config.py similarity index 100% rename from tests/wallet/cat_wallet/config.py rename to chia/_tests/wallet/cat_wallet/config.py diff --git a/tests/wallet/cat_wallet/test_cat_lifecycle.py b/chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py similarity index 99% rename from tests/wallet/cat_wallet/test_cat_lifecycle.py rename to chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py index cf9c743e914a..fa66bb241c60 100644 --- a/tests/wallet/cat_wallet/test_cat_lifecycle.py +++ b/chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py @@ -6,6 +6,9 @@ from chia_rs import AugSchemeMPL, G2Element, PrivateKey from clvm.casts import int_to_bytes +from chia._tests.clvm.benchmark_costs import cost_of_spend_bundle +from chia._tests.clvm.test_puzzles import secret_exponent_for_index +from chia._tests.conftest import ConsensusMode from chia.clvm.spend_sim import CostLogger, SimClient, SpendSim, sim_and_client from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program @@ -22,9 +25,6 @@ ) from chia.wallet.lineage_proof import LineageProof from chia.wallet.puzzles.tails import DelegatedLimitations, EverythingWithSig, GenesisById, GenesisByPuzhash -from tests.clvm.benchmark_costs import cost_of_spend_bundle -from tests.clvm.test_puzzles import secret_exponent_for_index -from tests.conftest import ConsensusMode acs = Program.to(1) acs_ph = acs.get_tree_hash() diff --git a/tests/wallet/cat_wallet/test_cat_outer_puzzle.py b/chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py similarity index 100% rename from tests/wallet/cat_wallet/test_cat_outer_puzzle.py rename to chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py diff --git a/tests/wallet/cat_wallet/test_cat_wallet.py b/chia/_tests/wallet/cat_wallet/test_cat_wallet.py similarity index 99% rename from tests/wallet/cat_wallet/test_cat_wallet.py rename to chia/_tests/wallet/cat_wallet/test_cat_wallet.py index d6b3f51424f5..17ea27bd7dba 100644 --- a/tests/wallet/cat_wallet/test_cat_wallet.py +++ b/chia/_tests/wallet/cat_wallet/test_cat_wallet.py @@ -6,6 +6,9 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets, SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.protocols.wallet_protocol import CoinState from chia.rpc.wallet_rpc_api import WalletRpcApi @@ -33,9 +36,6 @@ from chia.wallet.wallet_interested_store import WalletInterestedStore from chia.wallet.wallet_node import WalletNode from chia.wallet.wallet_state_manager import WalletStateManager -from tests.conftest import ConsensusMode -from tests.util.setup_nodes import OldSimulatorsAndWallets, SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none def check_wallets(node: WalletNode) -> int: diff --git a/tests/wallet/cat_wallet/test_offer_lifecycle.py b/chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py similarity index 100% rename from tests/wallet/cat_wallet/test_offer_lifecycle.py rename to chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py diff --git a/tests/wallet/cat_wallet/test_trades.py b/chia/_tests/wallet/cat_wallet/test_trades.py similarity index 99% rename from tests/wallet/cat_wallet/test_trades.py rename to chia/_tests/wallet/cat_wallet/test_trades.py index a60077c3f733..e2c9c4b7833a 100644 --- a/tests/wallet/cat_wallet/test_trades.py +++ b/chia/_tests/wallet/cat_wallet/test_trades.py @@ -6,6 +6,10 @@ import pytest from chia_rs import G2Element +from chia._tests.conftest import SOFTFORK_HEIGHTS, ConsensusMode +from chia._tests.environments.wallet import WalletEnvironment, WalletStateTransition, WalletTestFramework +from chia._tests.util.time_out_assert import time_out_assert +from chia._tests.wallet.vc_wallet.test_vc_wallet import mint_cr_cat from chia.consensus.cost_calculator import NPCResult from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.full_node.bundle_tools import simple_solution_generator @@ -27,10 +31,6 @@ from chia.wallet.vc_wallet.cr_cat_drivers import ProofsChecker from chia.wallet.vc_wallet.cr_cat_wallet import CRCATWallet from chia.wallet.vc_wallet.vc_store import VCProofs -from tests.conftest import SOFTFORK_HEIGHTS, ConsensusMode -from tests.environments.wallet import WalletEnvironment, WalletStateTransition, WalletTestFramework -from tests.util.time_out_assert import time_out_assert -from tests.wallet.vc_wallet.test_vc_wallet import mint_cr_cat async def get_trade_and_status(trade_manager: TradeManager, trade: TradeRecord) -> TradeStatus: diff --git a/tests/wallet/clawback/__init__.py b/chia/_tests/wallet/clawback/__init__.py similarity index 100% rename from tests/wallet/clawback/__init__.py rename to chia/_tests/wallet/clawback/__init__.py diff --git a/tests/wallet/clawback/config.py b/chia/_tests/wallet/clawback/config.py similarity index 100% rename from tests/wallet/clawback/config.py rename to chia/_tests/wallet/clawback/config.py diff --git a/tests/wallet/clawback/test_clawback_decorator.py b/chia/_tests/wallet/clawback/test_clawback_decorator.py similarity index 100% rename from tests/wallet/clawback/test_clawback_decorator.py rename to chia/_tests/wallet/clawback/test_clawback_decorator.py diff --git a/tests/wallet/clawback/test_clawback_lifecycle.py b/chia/_tests/wallet/clawback/test_clawback_lifecycle.py similarity index 97% rename from tests/wallet/clawback/test_clawback_lifecycle.py rename to chia/_tests/wallet/clawback/test_clawback_lifecycle.py index f2024a6530ce..b7cfc939efe2 100644 --- a/tests/wallet/clawback/test_clawback_lifecycle.py +++ b/chia/_tests/wallet/clawback/test_clawback_lifecycle.py @@ -5,6 +5,10 @@ import pytest from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey +from chia._tests.clvm.benchmark_costs import cost_of_spend_bundle +from chia._tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index +from chia._tests.util.key_tool import KeyTool +from chia._tests.util.time_out_assert import time_out_assert from chia.clvm.spend_sim import CostLogger, SimClient, SpendSim, sim_and_client from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.program import INFINITE_COST, Program @@ -35,10 +39,6 @@ from chia.wallet.uncurried_puzzle import uncurry_puzzle from chia.wallet.util.merkle_utils import check_merkle_proof from chia.wallet.util.wallet_types import RemarkDataType -from tests.clvm.benchmark_costs import cost_of_spend_bundle -from tests.clvm.test_puzzles import public_key_for_index, secret_exponent_for_index -from tests.util.key_tool import KeyTool -from tests.util.time_out_assert import time_out_assert ACS = Program.to(1) ACS_PH = ACS.get_tree_hash() diff --git a/tests/wallet/clawback/test_clawback_metadata.py b/chia/_tests/wallet/clawback/test_clawback_metadata.py similarity index 100% rename from tests/wallet/clawback/test_clawback_metadata.py rename to chia/_tests/wallet/clawback/test_clawback_metadata.py diff --git a/tests/wallet/config.py b/chia/_tests/wallet/config.py similarity index 100% rename from tests/wallet/config.py rename to chia/_tests/wallet/config.py diff --git a/tests/wallet/conftest.py b/chia/_tests/wallet/conftest.py similarity index 96% rename from tests/wallet/conftest.py rename to chia/_tests/wallet/conftest.py index 3ed209e698c5..ba5429743576 100644 --- a/tests/wallet/conftest.py +++ b/chia/_tests/wallet/conftest.py @@ -6,14 +6,14 @@ import pytest +from chia._tests.environments.wallet import WalletEnvironment, WalletState, WalletTestFramework +from chia._tests.util.setup_nodes import setup_simulators_and_wallets_service from chia.consensus.constants import ConsensusConstants from chia.rpc.wallet_rpc_client import WalletRpcClient from chia.types.peer_info import PeerInfo from chia.util.ints import uint32, uint64, uint128 from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig from chia.wallet.wallet_node import Balance -from tests.environments.wallet import WalletEnvironment, WalletState, WalletTestFramework -from tests.util.setup_nodes import setup_simulators_and_wallets_service @pytest.fixture(scope="function", params=[True, False]) diff --git a/tests/wallet/dao_wallet/__init__.py b/chia/_tests/wallet/dao_wallet/__init__.py similarity index 100% rename from tests/wallet/dao_wallet/__init__.py rename to chia/_tests/wallet/dao_wallet/__init__.py diff --git a/tests/wallet/dao_wallet/config.py b/chia/_tests/wallet/dao_wallet/config.py similarity index 100% rename from tests/wallet/dao_wallet/config.py rename to chia/_tests/wallet/dao_wallet/config.py diff --git a/tests/wallet/dao_wallet/test_dao_clvm.py b/chia/_tests/wallet/dao_wallet/test_dao_clvm.py similarity index 100% rename from tests/wallet/dao_wallet/test_dao_clvm.py rename to chia/_tests/wallet/dao_wallet/test_dao_clvm.py diff --git a/tests/wallet/dao_wallet/test_dao_wallets.py b/chia/_tests/wallet/dao_wallet/test_dao_wallets.py similarity index 99% rename from tests/wallet/dao_wallet/test_dao_wallets.py rename to chia/_tests/wallet/dao_wallet/test_dao_wallets.py index 8a6a5237a2ce..558202ff2ae8 100644 --- a/tests/wallet/dao_wallet/test_dao_wallets.py +++ b/chia/_tests/wallet/dao_wallet/test_dao_wallets.py @@ -6,6 +6,10 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.rpc import validate_get_routes +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets, SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.rpc.wallet_rpc_api import WalletRpcApi from chia.rpc.wallet_rpc_client import WalletRpcClient @@ -28,10 +32,6 @@ from chia.wallet.dao_wallet.dao_wallet import DAOWallet from chia.wallet.transaction_record import TransactionRecord from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from tests.conftest import ConsensusMode -from tests.util.rpc import validate_get_routes -from tests.util.setup_nodes import OldSimulatorsAndWallets, SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none async def get_proposal_state(wallet: DAOWallet, index: int) -> Tuple[Optional[bool], Optional[bool]]: diff --git a/tests/wallet/db_wallet/__init__.py b/chia/_tests/wallet/db_wallet/__init__.py similarity index 100% rename from tests/wallet/db_wallet/__init__.py rename to chia/_tests/wallet/db_wallet/__init__.py diff --git a/tests/wallet/db_wallet/config.py b/chia/_tests/wallet/db_wallet/config.py similarity index 100% rename from tests/wallet/db_wallet/config.py rename to chia/_tests/wallet/db_wallet/config.py diff --git a/tests/wallet/db_wallet/test_db_graftroot.py b/chia/_tests/wallet/db_wallet/test_db_graftroot.py similarity index 100% rename from tests/wallet/db_wallet/test_db_graftroot.py rename to chia/_tests/wallet/db_wallet/test_db_graftroot.py diff --git a/tests/wallet/db_wallet/test_dl_offers.py b/chia/_tests/wallet/db_wallet/test_dl_offers.py similarity index 99% rename from tests/wallet/db_wallet/test_dl_offers.py rename to chia/_tests/wallet/db_wallet/test_dl_offers.py index 8764f752ee16..39b90b04c420 100644 --- a/tests/wallet/db_wallet/test_dl_offers.py +++ b/chia/_tests/wallet/db_wallet/test_dl_offers.py @@ -4,6 +4,8 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.time_out_assert import time_out_assert from chia.data_layer.data_layer_wallet import DataLayerWallet from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint64 @@ -13,8 +15,6 @@ from chia.wallet.trading.trade_status import TradeStatus from chia.wallet.util.merkle_utils import build_merkle_tree, simplify_merkle_proof from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from tests.conftest import ConsensusMode -from tests.util.time_out_assert import time_out_assert async def is_singleton_confirmed_and_root(dl_wallet: DataLayerWallet, lid: bytes32, root: bytes32) -> bool: diff --git a/tests/wallet/db_wallet/test_dl_wallet.py b/chia/_tests/wallet/db_wallet/test_dl_wallet.py similarity index 99% rename from tests/wallet/db_wallet/test_dl_wallet.py rename to chia/_tests/wallet/db_wallet/test_dl_wallet.py index 976c067cae7f..6f78f6f0e183 100644 --- a/tests/wallet/db_wallet/test_dl_wallet.py +++ b/chia/_tests/wallet/db_wallet/test_dl_wallet.py @@ -6,6 +6,9 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets +from chia._tests.util.time_out_assert import time_out_assert from chia.data_layer.data_layer_errors import LauncherCoinNotFoundError from chia.data_layer.data_layer_wallet import DataLayerWallet, Mirror from chia.simulator.simulator_protocol import FarmNewBlockProtocol @@ -18,9 +21,6 @@ from chia.wallet.db_wallet.db_wallet_puzzles import create_mirror_puzzle from chia.wallet.util.merkle_tree import MerkleTree from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from tests.conftest import ConsensusMode -from tests.util.setup_nodes import OldSimulatorsAndWallets -from tests.util.time_out_assert import time_out_assert pytestmark = pytest.mark.data_layer diff --git a/tests/wallet/did_wallet/__init__.py b/chia/_tests/wallet/did_wallet/__init__.py similarity index 100% rename from tests/wallet/did_wallet/__init__.py rename to chia/_tests/wallet/did_wallet/__init__.py diff --git a/tests/wallet/did_wallet/config.py b/chia/_tests/wallet/did_wallet/config.py similarity index 100% rename from tests/wallet/did_wallet/config.py rename to chia/_tests/wallet/did_wallet/config.py diff --git a/tests/wallet/did_wallet/test_did.py b/chia/_tests/wallet/did_wallet/test_did.py similarity index 99% rename from tests/wallet/did_wallet/test_did.py rename to chia/_tests/wallet/did_wallet/test_did.py index 60e9bd01888a..6adaaeba21e3 100644 --- a/tests/wallet/did_wallet/test_did.py +++ b/chia/_tests/wallet/did_wallet/test_did.py @@ -7,6 +7,8 @@ import pytest from chia_rs import AugSchemeMPL, G1Element, G2Element +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.rpc.wallet_rpc_api import WalletRpcApi from chia.simulator.simulator_protocol import FarmNewBlockProtocol from chia.types.blockchain_format.program import Program @@ -23,8 +25,6 @@ from chia.wallet.util.address_type import AddressType from chia.wallet.util.tx_config import DEFAULT_COIN_SELECTION_CONFIG, DEFAULT_TX_CONFIG from chia.wallet.util.wallet_types import WalletType -from tests.util.setup_nodes import OldSimulatorsAndWallets -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none async def get_wallet_num(wallet_manager): diff --git a/tests/wallet/nft_wallet/__init__.py b/chia/_tests/wallet/nft_wallet/__init__.py similarity index 100% rename from tests/wallet/nft_wallet/__init__.py rename to chia/_tests/wallet/nft_wallet/__init__.py diff --git a/tests/wallet/nft_wallet/config.py b/chia/_tests/wallet/nft_wallet/config.py similarity index 100% rename from tests/wallet/nft_wallet/config.py rename to chia/_tests/wallet/nft_wallet/config.py diff --git a/tests/wallet/nft_wallet/test_nft_1_offers.py b/chia/_tests/wallet/nft_wallet/test_nft_1_offers.py similarity index 99% rename from tests/wallet/nft_wallet/test_nft_1_offers.py rename to chia/_tests/wallet/nft_wallet/test_nft_1_offers.py index 84f2e2d3efe5..1d1936b0df37 100644 --- a/tests/wallet/nft_wallet/test_nft_1_offers.py +++ b/chia/_tests/wallet/nft_wallet/test_nft_1_offers.py @@ -7,6 +7,8 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.simulator.full_node_simulator import FullNodeSimulator from chia.simulator.simulator_protocol import FarmNewBlockProtocol @@ -25,8 +27,6 @@ from chia.wallet.util.compute_memos import compute_memos from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.wallet_node import WalletNode -from tests.conftest import ConsensusMode -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none # from clvm_tools.binutils import disassemble diff --git a/tests/wallet/nft_wallet/test_nft_bulk_mint.py b/chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py similarity index 99% rename from tests/wallet/nft_wallet/test_nft_bulk_mint.py rename to chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py index 970a83217b70..466d079d3c0e 100644 --- a/tests/wallet/nft_wallet/test_nft_bulk_mint.py +++ b/chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py @@ -5,6 +5,8 @@ import pytest +from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.rpc.full_node_rpc_client import FullNodeRpcClient from chia.rpc.wallet_rpc_api import WalletRpcApi @@ -22,8 +24,6 @@ from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT from chia.wallet.util.address_type import AddressType from chia.wallet.util.tx_config import DEFAULT_COIN_SELECTION_CONFIG, DEFAULT_TX_CONFIG -from tests.util.setup_nodes import SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none async def nft_count(wallet: NFTWallet) -> int: diff --git a/tests/wallet/nft_wallet/test_nft_lifecycle.py b/chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py similarity index 100% rename from tests/wallet/nft_wallet/test_nft_lifecycle.py rename to chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py diff --git a/tests/wallet/nft_wallet/test_nft_offers.py b/chia/_tests/wallet/nft_wallet/test_nft_offers.py similarity index 99% rename from tests/wallet/nft_wallet/test_nft_offers.py rename to chia/_tests/wallet/nft_wallet/test_nft_offers.py index 665991781274..4333b6bbc1fd 100644 --- a/tests/wallet/nft_wallet/test_nft_offers.py +++ b/chia/_tests/wallet/nft_wallet/test_nft_offers.py @@ -5,6 +5,9 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none +from chia._tests.wallet.nft_wallet.test_nft_1_offers import mempool_not_empty from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.simulator.full_node_simulator import FullNodeSimulator from chia.simulator.simulator_protocol import FarmNewBlockProtocol @@ -21,9 +24,6 @@ from chia.wallet.uncurried_puzzle import uncurry_puzzle from chia.wallet.util.debug_spend_bundle import disassemble from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from tests.conftest import ConsensusMode -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none -from tests.wallet.nft_wallet.test_nft_1_offers import mempool_not_empty async def get_trade_and_status(trade_manager, trade) -> TradeStatus: # type: ignore diff --git a/tests/wallet/nft_wallet/test_nft_puzzles.py b/chia/_tests/wallet/nft_wallet/test_nft_puzzles.py similarity index 99% rename from tests/wallet/nft_wallet/test_nft_puzzles.py rename to chia/_tests/wallet/nft_wallet/test_nft_puzzles.py index a79b3cbb9fcb..602e733dad56 100644 --- a/tests/wallet/nft_wallet/test_nft_puzzles.py +++ b/chia/_tests/wallet/nft_wallet/test_nft_puzzles.py @@ -3,6 +3,7 @@ import random from typing import Tuple +from chia._tests.core.make_block_generator import int_to_public_key from chia.types.blockchain_format.program import Program from chia.types.blockchain_format.sized_bytes import bytes32 from chia.wallet.nft_wallet import uncurry_nft @@ -16,7 +17,6 @@ from chia.wallet.puzzles.load_clvm import load_clvm from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk, solution_for_conditions from chia.wallet.uncurried_puzzle import uncurry_puzzle -from tests.core.make_block_generator import int_to_public_key SINGLETON_MOD = load_clvm("singleton_top_layer_v1_1.clsp") LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clsp") diff --git a/tests/wallet/nft_wallet/test_nft_wallet.py b/chia/_tests/wallet/nft_wallet/test_nft_wallet.py similarity index 99% rename from tests/wallet/nft_wallet/test_nft_wallet.py rename to chia/_tests/wallet/nft_wallet/test_nft_wallet.py index f2a948c351d9..63b36a982412 100644 --- a/tests/wallet/nft_wallet/test_nft_wallet.py +++ b/chia/_tests/wallet/nft_wallet/test_nft_wallet.py @@ -9,6 +9,9 @@ from chia_rs import AugSchemeMPL, G1Element, G2Element from clvm_tools.binutils import disassemble +from chia._tests.conftest import ConsensusMode +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.rpc.wallet_rpc_api import WalletRpcApi from chia.simulator.full_node_simulator import FullNodeSimulator @@ -31,9 +34,6 @@ from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet_node import WalletNode from chia.wallet.wallet_state_manager import WalletStateManager -from tests.conftest import ConsensusMode -from tests.util.setup_nodes import OldSimulatorsAndWallets -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none async def get_nft_count(wallet: NFTWallet) -> int: diff --git a/tests/wallet/nft_wallet/test_ownership_outer_puzzle.py b/chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py similarity index 100% rename from tests/wallet/nft_wallet/test_ownership_outer_puzzle.py rename to chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py diff --git a/tests/wallet/rpc/__init__.py b/chia/_tests/wallet/rpc/__init__.py similarity index 100% rename from tests/wallet/rpc/__init__.py rename to chia/_tests/wallet/rpc/__init__.py diff --git a/tests/wallet/rpc/config.py b/chia/_tests/wallet/rpc/config.py similarity index 100% rename from tests/wallet/rpc/config.py rename to chia/_tests/wallet/rpc/config.py diff --git a/tests/wallet/rpc/test_dl_wallet_rpc.py b/chia/_tests/wallet/rpc/test_dl_wallet_rpc.py similarity index 97% rename from tests/wallet/rpc/test_dl_wallet_rpc.py rename to chia/_tests/wallet/rpc/test_dl_wallet_rpc.py index fa457732e1b7..021ac4773d1f 100644 --- a/tests/wallet/rpc/test_dl_wallet_rpc.py +++ b/chia/_tests/wallet/rpc/test_dl_wallet_rpc.py @@ -5,6 +5,10 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.rpc import validate_get_routes +from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices +from chia._tests.util.time_out_assert import time_out_assert from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.data_layer.data_layer_wallet import Mirror from chia.rpc.wallet_rpc_client import WalletRpcClient @@ -13,10 +17,6 @@ from chia.types.peer_info import PeerInfo from chia.util.ints import uint32, uint64 from chia.wallet.db_wallet.db_wallet_puzzles import create_mirror_puzzle -from tests.conftest import ConsensusMode -from tests.util.rpc import validate_get_routes -from tests.util.setup_nodes import SimulatorsAndWalletsServices -from tests.util.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/wallet/rpc/test_wallet_rpc.py b/chia/_tests/wallet/rpc/test_wallet_rpc.py similarity index 99% rename from tests/wallet/rpc/test_wallet_rpc.py rename to chia/_tests/wallet/rpc/test_wallet_rpc.py index 3fb6e2f878e7..36e99d2897f1 100644 --- a/tests/wallet/rpc/test_wallet_rpc.py +++ b/chia/_tests/wallet/rpc/test_wallet_rpc.py @@ -12,6 +12,34 @@ import pytest from chia_rs import G2Element +from chia._tests.conftest import ConsensusMode +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none +from chia._tests.wallet.test_wallet_coin_store import ( + get_coin_records_amount_filter_tests, + get_coin_records_amount_range_tests, + get_coin_records_coin_id_filter_tests, + get_coin_records_coin_type_tests, + get_coin_records_confirmed_range_tests, + get_coin_records_include_total_count_tests, + get_coin_records_mixed_tests, + get_coin_records_offset_limit_tests, + get_coin_records_order_tests, + get_coin_records_parent_coin_id_filter_tests, + get_coin_records_puzzle_hash_filter_tests, + get_coin_records_reverse_tests, + get_coin_records_spent_range_tests, + get_coin_records_wallet_id_tests, + get_coin_records_wallet_type_tests, + record_1, + record_2, + record_3, + record_4, + record_5, + record_6, + record_7, + record_8, + record_9, +) from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.consensus.coinbase import create_puzzlehash_for_pk from chia.rpc.full_node_rpc_client import FullNodeRpcClient @@ -59,34 +87,6 @@ from chia.wallet.wallet_coin_store import GetCoinRecords from chia.wallet.wallet_node import WalletNode from chia.wallet.wallet_protocol import WalletProtocol -from tests.conftest import ConsensusMode -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none -from tests.wallet.test_wallet_coin_store import ( - get_coin_records_amount_filter_tests, - get_coin_records_amount_range_tests, - get_coin_records_coin_id_filter_tests, - get_coin_records_coin_type_tests, - get_coin_records_confirmed_range_tests, - get_coin_records_include_total_count_tests, - get_coin_records_mixed_tests, - get_coin_records_offset_limit_tests, - get_coin_records_order_tests, - get_coin_records_parent_coin_id_filter_tests, - get_coin_records_puzzle_hash_filter_tests, - get_coin_records_reverse_tests, - get_coin_records_spent_range_tests, - get_coin_records_wallet_id_tests, - get_coin_records_wallet_type_tests, - record_1, - record_2, - record_3, - record_4, - record_5, - record_6, - record_7, - record_8, - record_9, -) log = logging.getLogger(__name__) diff --git a/tests/wallet/simple_sync/__init__.py b/chia/_tests/wallet/simple_sync/__init__.py similarity index 100% rename from tests/wallet/simple_sync/__init__.py rename to chia/_tests/wallet/simple_sync/__init__.py diff --git a/tests/wallet/simple_sync/config.py b/chia/_tests/wallet/simple_sync/config.py similarity index 100% rename from tests/wallet/simple_sync/config.py rename to chia/_tests/wallet/simple_sync/config.py diff --git a/tests/wallet/simple_sync/test_simple_sync_protocol.py b/chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py similarity index 99% rename from tests/wallet/simple_sync/test_simple_sync_protocol.py rename to chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py index 6bbf5fe9721d..ce2c2bbb3598 100644 --- a/tests/wallet/simple_sync/test_simple_sync_protocol.py +++ b/chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py @@ -8,6 +8,9 @@ from clvm.casts import int_to_bytes from colorlog import getLogger +from chia._tests.connection_utils import add_dummy_connection +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets +from chia._tests.util.time_out_assert import time_out_assert from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.protocols import wallet_protocol from chia.protocols.full_node_protocol import RespondTransaction @@ -26,9 +29,6 @@ from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.wallet import Wallet from chia.wallet.wallet_state_manager import WalletStateManager -from tests.connection_utils import add_dummy_connection -from tests.util.setup_nodes import OldSimulatorsAndWallets -from tests.util.time_out_assert import time_out_assert log = getLogger(__name__) diff --git a/tests/wallet/sync/__init__.py b/chia/_tests/wallet/sync/__init__.py similarity index 100% rename from tests/wallet/sync/__init__.py rename to chia/_tests/wallet/sync/__init__.py diff --git a/tests/wallet/sync/config.py b/chia/_tests/wallet/sync/config.py similarity index 100% rename from tests/wallet/sync/config.py rename to chia/_tests/wallet/sync/config.py diff --git a/tests/wallet/sync/test_wallet_sync.py b/chia/_tests/wallet/sync/test_wallet_sync.py similarity index 99% rename from tests/wallet/sync/test_wallet_sync.py rename to chia/_tests/wallet/sync/test_wallet_sync.py index 3c0eccff4043..870b97614702 100644 --- a/tests/wallet/sync/test_wallet_sync.py +++ b/chia/_tests/wallet/sync/test_wallet_sync.py @@ -10,6 +10,9 @@ from aiosqlite import Error as AIOSqliteError from colorlog import getLogger +from chia._tests.connection_utils import disconnect_all, disconnect_all_and_reconnect +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none +from chia._tests.weight_proof.test_weight_proof import load_blocks_dont_validate from chia.consensus.block_record import BlockRecord from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.full_node.weight_proof import WeightProofHandler @@ -32,9 +35,6 @@ from chia.wallet.util.wallet_sync_utils import PeerRequestException from chia.wallet.wallet_coin_record import WalletCoinRecord from chia.wallet.wallet_weight_proof_handler import get_wp_fork_point -from tests.connection_utils import disconnect_all, disconnect_all_and_reconnect -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none -from tests.weight_proof.test_weight_proof import load_blocks_dont_validate async def wallet_height_at_least(wallet_node, h): diff --git a/tests/wallet/test_address_type.py b/chia/_tests/wallet/test_address_type.py similarity index 100% rename from tests/wallet/test_address_type.py rename to chia/_tests/wallet/test_address_type.py diff --git a/tests/wallet/test_bech32m.py b/chia/_tests/wallet/test_bech32m.py similarity index 100% rename from tests/wallet/test_bech32m.py rename to chia/_tests/wallet/test_bech32m.py diff --git a/tests/wallet/test_chialisp.py b/chia/_tests/wallet/test_chialisp.py similarity index 100% rename from tests/wallet/test_chialisp.py rename to chia/_tests/wallet/test_chialisp.py diff --git a/tests/wallet/test_coin_selection.py b/chia/_tests/wallet/test_coin_selection.py similarity index 100% rename from tests/wallet/test_coin_selection.py rename to chia/_tests/wallet/test_coin_selection.py diff --git a/tests/wallet/test_conditions.py b/chia/_tests/wallet/test_conditions.py similarity index 100% rename from tests/wallet/test_conditions.py rename to chia/_tests/wallet/test_conditions.py diff --git a/tests/wallet/test_debug_spend_bundle.py b/chia/_tests/wallet/test_debug_spend_bundle.py similarity index 100% rename from tests/wallet/test_debug_spend_bundle.py rename to chia/_tests/wallet/test_debug_spend_bundle.py diff --git a/tests/wallet/test_nft_store.py b/chia/_tests/wallet/test_nft_store.py similarity index 99% rename from tests/wallet/test_nft_store.py rename to chia/_tests/wallet/test_nft_store.py index 723fac038fd6..be2fa7bcfc1e 100644 --- a/tests/wallet/test_nft_store.py +++ b/chia/_tests/wallet/test_nft_store.py @@ -6,6 +6,7 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program from chia.types.blockchain_format.sized_bytes import bytes32 @@ -13,7 +14,6 @@ from chia.wallet.lineage_proof import LineageProof from chia.wallet.nft_wallet.nft_info import NFTCoinInfo from chia.wallet.wallet_nft_store import WalletNftStore -from tests.util.db_connection import DBConnection def get_dummy_nft(random_: random.Random) -> NFTCoinInfo: diff --git a/tests/wallet/test_notifications.py b/chia/_tests/wallet/test_notifications.py similarity index 98% rename from tests/wallet/test_notifications.py rename to chia/_tests/wallet/test_notifications.py index f4446576fd07..813c7be605a9 100644 --- a/tests/wallet/test_notifications.py +++ b/chia/_tests/wallet/test_notifications.py @@ -7,6 +7,7 @@ import pytest +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward from chia.simulator.full_node_simulator import FullNodeSimulator from chia.simulator.simulator_protocol import FarmNewBlockProtocol @@ -16,7 +17,6 @@ from chia.util.ints import uint32, uint64 from chia.wallet.notification_store import NotificationStore from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none # For testing backwards compatibility with a DB change to add height diff --git a/tests/wallet/test_offer_parsing_performance.py b/chia/_tests/wallet/test_offer_parsing_performance.py similarity index 99% rename from tests/wallet/test_offer_parsing_performance.py rename to chia/_tests/wallet/test_offer_parsing_performance.py index d65a9a4c8fbb..1322f790fab2 100644 --- a/tests/wallet/test_offer_parsing_performance.py +++ b/chia/_tests/wallet/test_offer_parsing_performance.py @@ -4,8 +4,8 @@ from contextlib import contextmanager from typing import Iterator +from chia._tests.util.misc import BenchmarkRunner from chia.wallet.trading.offer import Offer -from tests.util.misc import BenchmarkRunner with_profile = False diff --git a/tests/wallet/test_puzzle_store.py b/chia/_tests/wallet/test_puzzle_store.py similarity index 99% rename from tests/wallet/test_puzzle_store.py rename to chia/_tests/wallet/test_puzzle_store.py index 3847d861a069..d33a75e59e68 100644 --- a/tests/wallet/test_puzzle_store.py +++ b/chia/_tests/wallet/test_puzzle_store.py @@ -7,12 +7,12 @@ import pytest from chia_rs import AugSchemeMPL +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint32 from chia.wallet.derivation_record import DerivationRecord from chia.wallet.util.wallet_types import WalletIdentifier, WalletType from chia.wallet.wallet_puzzle_store import WalletPuzzleStore -from tests.util.db_connection import DBConnection def get_dummy_record(index: int, wallet_id: int, seeded_random: random.Random) -> DerivationRecord: diff --git a/tests/wallet/test_sign_coin_spends.py b/chia/_tests/wallet/test_sign_coin_spends.py similarity index 100% rename from tests/wallet/test_sign_coin_spends.py rename to chia/_tests/wallet/test_sign_coin_spends.py diff --git a/tests/wallet/test_singleton.py b/chia/_tests/wallet/test_singleton.py similarity index 100% rename from tests/wallet/test_singleton.py rename to chia/_tests/wallet/test_singleton.py diff --git a/tests/wallet/test_singleton_lifecycle.py b/chia/_tests/wallet/test_singleton_lifecycle.py similarity index 98% rename from tests/wallet/test_singleton_lifecycle.py rename to chia/_tests/wallet/test_singleton_lifecycle.py index 543531dbd5ac..1dbd2b17900b 100644 --- a/tests/wallet/test_singleton_lifecycle.py +++ b/chia/_tests/wallet/test_singleton_lifecycle.py @@ -6,6 +6,7 @@ from chia_rs import G2Element from clvm_tools import binutils +from chia._tests.core.full_node.test_conditions import check_spend_bundle_validity, initial_blocks from chia.types.announcement import Announcement from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import INFINITE_COST, Program @@ -15,7 +16,6 @@ from chia.types.spend_bundle import SpendBundle from chia.util.ints import uint64 from chia.wallet.puzzles.load_clvm import load_clvm -from tests.core.full_node.test_conditions import check_spend_bundle_validity, initial_blocks SINGLETON_MOD = load_clvm("singleton_top_layer.clsp") LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clsp") diff --git a/tests/wallet/test_singleton_lifecycle_fast.py b/chia/_tests/wallet/test_singleton_lifecycle_fast.py similarity index 99% rename from tests/wallet/test_singleton_lifecycle_fast.py rename to chia/_tests/wallet/test_singleton_lifecycle_fast.py index 3b20ceb2ed31..7bacc9e898ca 100644 --- a/tests/wallet/test_singleton_lifecycle_fast.py +++ b/chia/_tests/wallet/test_singleton_lifecycle_fast.py @@ -6,6 +6,7 @@ from chia_rs import G1Element, G2Element from clvm_tools import binutils +from chia._tests.clvm.coin_store import BadSpendBundleError, CoinStore, CoinTimestamp from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.announcement import Announcement from chia.types.blockchain_format.coin import Coin @@ -18,7 +19,6 @@ from chia.util.ints import uint32, uint64 from chia.wallet.puzzles.load_clvm import load_clvm from chia.wallet.util.debug_spend_bundle import debug_spend_bundle -from tests.clvm.coin_store import BadSpendBundleError, CoinStore, CoinTimestamp SINGLETON_MOD = load_clvm("singleton_top_layer.clsp") LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clsp") diff --git a/tests/wallet/test_singleton_store.py b/chia/_tests/wallet/test_singleton_store.py similarity index 99% rename from tests/wallet/test_singleton_store.py rename to chia/_tests/wallet/test_singleton_store.py index de6c4d6e139e..dbce941174f9 100644 --- a/tests/wallet/test_singleton_store.py +++ b/chia/_tests/wallet/test_singleton_store.py @@ -5,6 +5,7 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program from chia.types.blockchain_format.sized_bytes import bytes32 @@ -16,7 +17,6 @@ from chia.wallet.singleton import create_singleton_puzzle from chia.wallet.singleton_record import SingletonRecord from chia.wallet.wallet_singleton_store import WalletSingletonStore -from tests.util.db_connection import DBConnection def get_record(wallet_id: uint32 = uint32(2)) -> SingletonRecord: diff --git a/tests/wallet/test_taproot.py b/chia/_tests/wallet/test_taproot.py similarity index 91% rename from tests/wallet/test_taproot.py rename to chia/_tests/wallet/test_taproot.py index d0b251dce3f6..0060f7c5779d 100644 --- a/tests/wallet/test_taproot.py +++ b/chia/_tests/wallet/test_taproot.py @@ -1,11 +1,11 @@ from __future__ import annotations +from chia._tests.core.make_block_generator import int_to_public_key from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( DEFAULT_HIDDEN_PUZZLE, calculate_synthetic_offset, calculate_synthetic_public_key, ) -from tests.core.make_block_generator import int_to_public_key class TestTaproot: diff --git a/tests/wallet/test_transaction_store.py b/chia/_tests/wallet/test_transaction_store.py similarity index 99% rename from tests/wallet/test_transaction_store.py rename to chia/_tests/wallet/test_transaction_store.py index f776aebb3938..3303aea9e1d5 100644 --- a/tests/wallet/test_transaction_store.py +++ b/chia/_tests/wallet/test_transaction_store.py @@ -6,6 +6,7 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.mempool_inclusion_status import MempoolInclusionStatus @@ -16,7 +17,6 @@ from chia.wallet.util.query_filter import TransactionTypeFilter from chia.wallet.util.transaction_type import TransactionType from chia.wallet.wallet_transaction_store import WalletTransactionStore, filter_ok_mempool_status -from tests.util.db_connection import DBConnection module_seeded_random = random.Random() module_seeded_random.seed(a=0, version=2) diff --git a/tests/wallet/test_util.py b/chia/_tests/wallet/test_util.py similarity index 98% rename from tests/wallet/test_util.py rename to chia/_tests/wallet/test_util.py index 93f9fa01385c..de379d0039e9 100644 --- a/tests/wallet/test_util.py +++ b/chia/_tests/wallet/test_util.py @@ -2,6 +2,7 @@ import pytest +from chia._tests.util.misc import CoinGenerator, coin_creation_args from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program @@ -17,7 +18,6 @@ CoinSelectionConfigLoader, TXConfigLoader, ) -from tests.util.misc import CoinGenerator, coin_creation_args def test_compute_spend_hints_and_additions() -> None: diff --git a/tests/wallet/test_wallet.py b/chia/_tests/wallet/test_wallet.py similarity index 99% rename from tests/wallet/test_wallet.py rename to chia/_tests/wallet/test_wallet.py index a87b02e56ad2..21be75d8d693 100644 --- a/tests/wallet/test_wallet.py +++ b/chia/_tests/wallet/test_wallet.py @@ -10,6 +10,8 @@ import pytest from chia_rs import AugSchemeMPL, G1Element, G2Element +from chia._tests.conftest import ConsensusMode +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none from chia.rpc.wallet_rpc_api import WalletRpcApi from chia.server.server import ChiaServer from chia.simulator.block_tools import BlockTools @@ -34,8 +36,6 @@ from chia.wallet.util.wallet_types import CoinType from chia.wallet.wallet_node import WalletNode, get_wallet_db_path from chia.wallet.wallet_state_manager import WalletStateManager -from tests.conftest import ConsensusMode -from tests.util.time_out_assert import time_out_assert, time_out_assert_not_none class TestWalletSimulator: diff --git a/tests/wallet/test_wallet_blockchain.py b/chia/_tests/wallet/test_wallet_blockchain.py similarity index 97% rename from tests/wallet/test_wallet_blockchain.py rename to chia/_tests/wallet/test_wallet_blockchain.py index 4364c5a83aa4..e158b2e43613 100644 --- a/tests/wallet/test_wallet_blockchain.py +++ b/chia/_tests/wallet/test_wallet_blockchain.py @@ -4,6 +4,8 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.db_connection import DBConnection from chia.consensus.blockchain import AddBlockResult from chia.protocols import full_node_protocol from chia.types.blockchain_format.vdf import VDFProof @@ -11,8 +13,6 @@ from chia.util.generator_tools import get_block_header from chia.wallet.key_val_store import KeyValStore from chia.wallet.wallet_blockchain import WalletBlockchain -from tests.conftest import ConsensusMode -from tests.util.db_connection import DBConnection class TestWalletBlockchain: diff --git a/tests/wallet/test_wallet_coin_store.py b/chia/_tests/wallet/test_wallet_coin_store.py similarity index 99% rename from tests/wallet/test_wallet_coin_store.py rename to chia/_tests/wallet/test_wallet_coin_store.py index 0082466eb6f5..c2c3ee1ecfd8 100644 --- a/tests/wallet/test_wallet_coin_store.py +++ b/chia/_tests/wallet/test_wallet_coin_store.py @@ -6,6 +6,7 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint8, uint16, uint32, uint64 @@ -16,7 +17,6 @@ from chia.wallet.util.wallet_types import CoinType, WalletType from chia.wallet.wallet_coin_record import WalletCoinRecord from chia.wallet.wallet_coin_store import CoinRecordOrder, GetCoinRecords, GetCoinRecordsResult, WalletCoinStore -from tests.util.db_connection import DBConnection clawback_metadata = ClawbackMetadata(uint64(0), bytes32(b"1" * 32), bytes32(b"2" * 32)) diff --git a/tests/wallet/test_wallet_interested_store.py b/chia/_tests/wallet/test_wallet_interested_store.py similarity index 97% rename from tests/wallet/test_wallet_interested_store.py rename to chia/_tests/wallet/test_wallet_interested_store.py index 71caad376abd..15a1da9f5ed1 100644 --- a/tests/wallet/test_wallet_interested_store.py +++ b/chia/_tests/wallet/test_wallet_interested_store.py @@ -4,11 +4,11 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint64 from chia.wallet.wallet_interested_store import WalletInterestedStore -from tests.util.db_connection import DBConnection class TestWalletInterestedStore: diff --git a/tests/wallet/test_wallet_key_val_store.py b/chia/_tests/wallet/test_wallet_key_val_store.py similarity index 96% rename from tests/wallet/test_wallet_key_val_store.py rename to chia/_tests/wallet/test_wallet_key_val_store.py index c1c06380489f..04bc53d88cdd 100644 --- a/tests/wallet/test_wallet_key_val_store.py +++ b/chia/_tests/wallet/test_wallet_key_val_store.py @@ -2,10 +2,10 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.types.full_block import FullBlock from chia.types.header_block import HeaderBlock from chia.wallet.key_val_store import KeyValStore -from tests.util.db_connection import DBConnection class TestWalletKeyValStore: diff --git a/tests/wallet/test_wallet_node.py b/chia/_tests/wallet/test_wallet_node.py similarity index 99% rename from tests/wallet/test_wallet_node.py rename to chia/_tests/wallet/test_wallet_node.py index 18a2e4f70654..2c4ccb4b985f 100644 --- a/tests/wallet/test_wallet_node.py +++ b/chia/_tests/wallet/test_wallet_node.py @@ -10,6 +10,10 @@ import pytest +from chia._tests.conftest import ConsensusMode +from chia._tests.util.misc import CoinGenerator +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets +from chia._tests.util.time_out_assert import time_out_assert from chia.protocols import wallet_protocol from chia.protocols.protocol_message_types import ProtocolMessageTypes from chia.protocols.wallet_protocol import CoinState @@ -26,10 +30,6 @@ from chia.util.keychain import Keychain, KeyData, generate_mnemonic from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.wallet_node import Balance, WalletNode -from tests.conftest import ConsensusMode -from tests.util.misc import CoinGenerator -from tests.util.setup_nodes import OldSimulatorsAndWallets -from tests.util.time_out_assert import time_out_assert @pytest.mark.anyio diff --git a/tests/wallet/test_wallet_retry.py b/chia/_tests/wallet/test_wallet_retry.py similarity index 97% rename from tests/wallet/test_wallet_retry.py rename to chia/_tests/wallet/test_wallet_retry.py index ff776b34b0d0..c8889e782aa4 100644 --- a/tests/wallet/test_wallet_retry.py +++ b/chia/_tests/wallet/test_wallet_retry.py @@ -5,6 +5,7 @@ import pytest +from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval from chia.full_node.full_node_api import FullNodeAPI from chia.full_node.mempool import MempoolRemoveReason from chia.simulator.block_tools import BlockTools @@ -17,7 +18,6 @@ from chia.wallet.transaction_record import TransactionRecord from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.wallet_node import WalletNode -from tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval async def farm_blocks(full_node_api: FullNodeSimulator, ph: bytes32, num_blocks: int) -> int: diff --git a/tests/wallet/test_wallet_state_manager.py b/chia/_tests/wallet/test_wallet_state_manager.py similarity index 98% rename from tests/wallet/test_wallet_state_manager.py rename to chia/_tests/wallet/test_wallet_state_manager.py index 4398a84263b6..ba05df9088bd 100644 --- a/tests/wallet/test_wallet_state_manager.py +++ b/chia/_tests/wallet/test_wallet_state_manager.py @@ -5,6 +5,7 @@ import pytest +from chia._tests.util.setup_nodes import OldSimulatorsAndWallets from chia.protocols.wallet_protocol import CoinState from chia.server.outbound_message import NodeType from chia.types.blockchain_format.coin import Coin @@ -15,7 +16,6 @@ from chia.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet_state_manager import WalletStateManager -from tests.util.setup_nodes import OldSimulatorsAndWallets @asynccontextmanager diff --git a/tests/wallet/test_wallet_test_framework.py b/chia/_tests/wallet/test_wallet_test_framework.py similarity index 99% rename from tests/wallet/test_wallet_test_framework.py rename to chia/_tests/wallet/test_wallet_test_framework.py index 4cc1984cf7ba..e7cb7ad731af 100644 --- a/tests/wallet/test_wallet_test_framework.py +++ b/chia/_tests/wallet/test_wallet_test_framework.py @@ -2,13 +2,13 @@ import pytest -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from tests.environments.wallet import ( +from chia._tests.environments.wallet import ( BalanceCheckingError, WalletEnvironment, WalletStateTransition, WalletTestFramework, ) +from chia.wallet.cat_wallet.cat_wallet import CATWallet @pytest.mark.parametrize( diff --git a/tests/wallet/test_wallet_trade_store.py b/chia/_tests/wallet/test_wallet_trade_store.py similarity index 99% rename from tests/wallet/test_wallet_trade_store.py rename to chia/_tests/wallet/test_wallet_trade_store.py index cc92a72b23cd..68f876cc8f2a 100644 --- a/tests/wallet/test_wallet_trade_store.py +++ b/chia/_tests/wallet/test_wallet_trade_store.py @@ -6,6 +6,7 @@ import pytest from chia_rs import G2Element +from chia._tests.util.db_connection import DBConnection from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.sized_bytes import bytes32 from chia.types.spend_bundle import SpendBundle @@ -18,7 +19,6 @@ from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet_coin_record import WalletCoinRecord from chia.wallet.wallet_coin_store import WalletCoinStore -from tests.util.db_connection import DBConnection module_seeded_random = random.Random() module_seeded_random.seed(a=0, version=2) diff --git a/tests/wallet/test_wallet_user_store.py b/chia/_tests/wallet/test_wallet_user_store.py similarity index 95% rename from tests/wallet/test_wallet_user_store.py rename to chia/_tests/wallet/test_wallet_user_store.py index 6bb7dd03abce..c21c0979382d 100644 --- a/tests/wallet/test_wallet_user_store.py +++ b/chia/_tests/wallet/test_wallet_user_store.py @@ -2,9 +2,9 @@ import pytest +from chia._tests.util.db_connection import DBConnection from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet_user_store import WalletUserStore -from tests.util.db_connection import DBConnection @pytest.mark.anyio diff --git a/tests/wallet/test_wallet_utils.py b/chia/_tests/wallet/test_wallet_utils.py similarity index 100% rename from tests/wallet/test_wallet_utils.py rename to chia/_tests/wallet/test_wallet_utils.py diff --git a/tests/wallet/vc_wallet/__init__.py b/chia/_tests/wallet/vc_wallet/__init__.py similarity index 100% rename from tests/wallet/vc_wallet/__init__.py rename to chia/_tests/wallet/vc_wallet/__init__.py diff --git a/tests/wallet/vc_wallet/config.py b/chia/_tests/wallet/vc_wallet/config.py similarity index 100% rename from tests/wallet/vc_wallet/config.py rename to chia/_tests/wallet/vc_wallet/config.py diff --git a/tests/wallet/vc_wallet/test_cr_outer_puzzle.py b/chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py similarity index 100% rename from tests/wallet/vc_wallet/test_cr_outer_puzzle.py rename to chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py diff --git a/tests/wallet/vc_wallet/test_vc_lifecycle.py b/chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py similarity index 100% rename from tests/wallet/vc_wallet/test_vc_lifecycle.py rename to chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py diff --git a/tests/wallet/vc_wallet/test_vc_wallet.py b/chia/_tests/wallet/vc_wallet/test_vc_wallet.py similarity index 99% rename from tests/wallet/vc_wallet/test_vc_wallet.py rename to chia/_tests/wallet/vc_wallet/test_vc_wallet.py index 8415b64ec182..eb4b0f6526f9 100644 --- a/tests/wallet/vc_wallet/test_vc_wallet.py +++ b/chia/_tests/wallet/vc_wallet/test_vc_wallet.py @@ -7,6 +7,8 @@ from chia_rs import G2Element from typing_extensions import Literal +from chia._tests.environments.wallet import WalletEnvironment, WalletStateTransition, WalletTestFramework +from chia._tests.util.time_out_assert import time_out_assert_not_none from chia.rpc.wallet_rpc_client import WalletRpcClient from chia.simulator.full_node_simulator import FullNodeSimulator from chia.types.blockchain_format.coin import coin_as_list @@ -29,8 +31,6 @@ from chia.wallet.vc_wallet.vc_store import VCProofs, VCRecord from chia.wallet.wallet import Wallet from chia.wallet.wallet_node import WalletNode -from tests.environments.wallet import WalletEnvironment, WalletStateTransition, WalletTestFramework -from tests.util.time_out_assert import time_out_assert_not_none async def mint_cr_cat( diff --git a/tests/weight_proof/__init__.py b/chia/_tests/weight_proof/__init__.py similarity index 100% rename from tests/weight_proof/__init__.py rename to chia/_tests/weight_proof/__init__.py diff --git a/tests/weight_proof/config.py b/chia/_tests/weight_proof/config.py similarity index 100% rename from tests/weight_proof/config.py rename to chia/_tests/weight_proof/config.py diff --git a/tests/weight_proof/test_weight_proof.py b/chia/_tests/weight_proof/test_weight_proof.py similarity index 100% rename from tests/weight_proof/test_weight_proof.py rename to chia/_tests/weight_proof/test_weight_proof.py diff --git a/tools/generate_chain.py b/tools/generate_chain.py index 591fd671c77f..985158b9d39f 100644 --- a/tools/generate_chain.py +++ b/tools/generate_chain.py @@ -12,13 +12,13 @@ import click import zstd +from chia._tests.util.constants import test_constants from chia.simulator.block_tools import create_block_tools from chia.simulator.keyring import TempKeyring from chia.types.blockchain_format.coin import Coin from chia.types.spend_bundle import SpendBundle from chia.util.chia_logging import initialize_logging from chia.util.ints import uint32, uint64 -from tests.util.constants import test_constants @contextmanager diff --git a/tools/run_block.py b/tools/run_block.py index 01fa3c8bcc8f..5abdc09013b7 100644 --- a/tools/run_block.py +++ b/tools/run_block.py @@ -42,10 +42,10 @@ import click +from chia._tests.util.run_block import run_json_block from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.util.config import load_config from chia.util.default_root import DEFAULT_ROOT_PATH -from tests.util.run_block import run_json_block @click.command() diff --git a/tools/test_full_sync.py b/tools/test_full_sync.py index 78cb2dbf5d67..1cf6c1888a7e 100755 --- a/tools/test_full_sync.py +++ b/tools/test_full_sync.py @@ -11,13 +11,13 @@ import click import zstd +from chia._tests.util.full_sync import FakePeer, FakeServer, run_sync_test from chia.cmds.init_funcs import chia_init from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.full_node.full_node import FullNode from chia.server.ws_connection import WSChiaConnection from chia.types.full_block import FullBlock from chia.util.config import load_config -from tests.util.full_sync import FakePeer, FakeServer, run_sync_test @click.group()