Rename TesterBlockchain on import in tests to prevent py.test from trying to pick it up

pull/1106/head
Bogdan Opanchuk 2019-06-26 22:48:33 -07:00
parent d83697648a
commit 39ecedd724
3 changed files with 11 additions and 8 deletions

View File

@ -25,7 +25,8 @@ from nucypher.blockchain.eth.actors import Deployer
from nucypher.blockchain.eth.interfaces import BlockchainDeployerInterface
from nucypher.blockchain.eth.registry import InMemoryEthereumContractRegistry, InMemoryAllocationRegistry
from nucypher.blockchain.eth.sol.compile import SolidityCompiler
from nucypher.utilities.sandbox.blockchain import TesterBlockchain
# Prevents TesterBlockchain to be picked up by py.test as a test class
from nucypher.utilities.sandbox.blockchain import TesterBlockchain as _TesterBlockchain
from nucypher.utilities.sandbox.constants import (
ONE_YEAR_IN_SECONDS,
USER_ESCROW_PROXY_DEPLOYMENT_SECRET,
@ -45,7 +46,7 @@ def test_rapid_deployment(token_economics):
registry=registry,
provider_uri=TEST_PROVIDER_URI)
blockchain = TesterBlockchain(interface=interface, eth_airdrop=False, test_accounts=4)
blockchain = _TesterBlockchain(interface=interface, eth_airdrop=False, test_accounts=4)
deployer_address = blockchain.etherbase_account
deployer = Deployer(blockchain=blockchain, deployer_address=deployer_address)

View File

@ -22,7 +22,8 @@ from nucypher.utilities.sandbox.constants import NUMBER_OF_ETH_TEST_ACCOUNTS, NU
from nucypher.blockchain.eth.interfaces import BlockchainDeployerInterface
from nucypher.blockchain.eth.registry import InMemoryEthereumContractRegistry
from nucypher.utilities.sandbox.blockchain import TesterBlockchain
# Prevents TesterBlockchain to be picked up by py.test as a test class
from nucypher.utilities.sandbox.blockchain import TesterBlockchain as _TesterBlockchain
@pytest.fixture()
@ -31,7 +32,7 @@ def another_testerchain(solidity_compiler):
deployer_interface = BlockchainDeployerInterface(compiler=solidity_compiler,
registry=memory_registry,
provider_uri=TEST_PROVIDER_URI)
testerchain = TesterBlockchain(interface=deployer_interface,
testerchain = _TesterBlockchain(interface=deployer_interface,
test_accounts=2*NUMBER_OF_ETH_TEST_ACCOUNTS,
eth_airdrop=True)
deployer_interface.deployer_address = testerchain.etherbase_account

View File

@ -19,7 +19,8 @@ from nucypher.blockchain.eth.registry import AllocationRegistry, EthereumContrac
from nucypher.blockchain.eth.sol.compile import SolidityCompiler
from nucypher.cli.deploy import deploy
from nucypher.config.constants import DEFAULT_CONFIG_ROOT
from nucypher.utilities.sandbox.blockchain import TesterBlockchain
# Prevents TesterBlockchain to be picked up by py.test as a test class
from nucypher.utilities.sandbox.blockchain import TesterBlockchain as _TesterBlockchain
from nucypher.utilities.sandbox.constants import (
TEST_PROVIDER_URI,
MOCK_REGISTRY_FILEPATH,
@ -42,7 +43,7 @@ def make_testerchain(provider_uri, solidity_compiler):
# Destroy existing blockchain
BlockchainInterface.disconnect()
TesterBlockchain.sever_connection()
_TesterBlockchain.sever_connection()
registry = EthereumContractRegistry(registry_filepath=MOCK_REGISTRY_FILEPATH)
deployer_interface = BlockchainDeployerInterface(compiler=solidity_compiler,
@ -50,7 +51,7 @@ def make_testerchain(provider_uri, solidity_compiler):
provider_uri=provider_uri)
# Create new blockchain
testerchain = TesterBlockchain(interface=deployer_interface,
testerchain = _TesterBlockchain(interface=deployer_interface,
eth_airdrop=True,
free_transactions=False,
poa=True)
@ -320,7 +321,7 @@ def test_nucypher_deploy_allocation_contracts(click_runner,
mock_allocation_infile,
token_economics):
TesterBlockchain.sever_connection()
_TesterBlockchain.sever_connection()
Agency.clear()
if os.path.isfile(MOCK_ALLOCATION_REGISTRY_FILEPATH):