def testchain_provider(blockchain_type, port_generator): eth_client = EthClient(blockchain_type) chain_manager = setup_testchain(eth_client=eth_client, print_step=lambda x: None, free_port_generator=port_generator) with chain_manager as testchain: yield testchain
def raiden_testchain( blockchain_type: str, port_generator, cli_tests_contracts_version: str ) -> Iterable[Dict[str, Any]]: import time start_time = time.monotonic() eth_client = EthClient(blockchain_type) # The private chain data is always discarded on the CI tmpdir = mkdtemp() base_datadir = str(tmpdir) # Save the Ethereum node's logs, if needed for debugging base_logdir = os.path.join(get_artifacts_storage() or str(tmpdir), blockchain_type) os.makedirs(base_logdir, exist_ok=True) testchain_manager: ContextManager[Dict[str, Any]] = setup_testchain( eth_client=eth_client, free_port_generator=port_generator, base_datadir=base_datadir, base_logdir=base_logdir, ) def dont_print_step( description: str, error: bool = False # pylint: disable=unused-argument ) -> None: pass with testchain_manager as testchain: result = setup_raiden( matrix_server=MATRIX_AUTO_SELECT_SERVER, print_step=dont_print_step, contracts_version=cli_tests_contracts_version, eth_rpc_endpoint=testchain["eth_rpc_endpoint"], web3=testchain["web3"], base_datadir=testchain["base_datadir"], keystore=testchain["keystore"], ) args = result.args # The setup of the testchain returns a TextIOWrapper but # for the tests we need a filename args["password_file"] = args["password_file"].name print("setup_raiden took", time.monotonic() - start_time) yield args
def raiden_testchain(blockchain_type, port_generator, cli_tests_contracts_version): import time start_time = time.monotonic() eth_client = EthClient(blockchain_type) # The private chain data is always discarded on the CI tmpdir = mkdtemp() base_datadir = str(tmpdir) # Save the Ethereum node's logs, if needed for debugging base_logdir = os.path.join(get_artifacts_storage() or str(tmpdir), blockchain_type) os.makedirs(base_logdir, exist_ok=True) testchain_manager: ContextManager[Dict[str, Any]] = setup_testchain( eth_client=eth_client, free_port_generator=port_generator, base_datadir=base_datadir, base_logdir=base_logdir, ) with testchain_manager as testchain: result = setup_raiden( transport="matrix", matrix_server="auto", print_step=lambda x: None, contracts_version=cli_tests_contracts_version, eth_client=testchain["eth_client"], eth_rpc_endpoint=testchain["eth_rpc_endpoint"], web3=testchain["web3"], base_datadir=testchain["base_datadir"], keystore=testchain["keystore"], ) result["ethereum_nodes"] = testchain["node_executors"] args = result["args"] # The setup of the testchain returns a TextIOWrapper but # for the tests we need a filename args["password_file"] = args["password_file"].name print("setup_raiden took", time.monotonic() - start_time) yield args
def testchain_provider(blockchain_type): eth_client = EthClient(blockchain_type) with setup_testchain(eth_client=eth_client, print_step=lambda x: None) as testchain: yield testchain