mirror of https://github.com/nucypher/nucypher.git
Yanking some autouses in favor of usefixtures. [skip ci]
parent
5d6ea95483
commit
2966171319
|
@ -20,8 +20,10 @@ from nucypher.cli.actions.select import select_client_account_for_staking
|
||||||
from nucypher.cli.literature import PREALLOCATION_STAKE_ADVISORY
|
from nucypher.cli.literature import PREALLOCATION_STAKE_ADVISORY
|
||||||
from nucypher.config.constants import TEMPORARY_DOMAIN
|
from nucypher.config.constants import TEMPORARY_DOMAIN
|
||||||
from tests.constants import YES
|
from tests.constants import YES
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures('mock_contract_agency')
|
||||||
def test_select_client_account_for_staking_cli_action(test_emitter,
|
def test_select_client_account_for_staking_cli_action(test_emitter,
|
||||||
test_registry,
|
test_registry,
|
||||||
test_registry_source_manager,
|
test_registry_source_manager,
|
||||||
|
|
|
@ -44,7 +44,7 @@ def mock_account_password_keystore(tmp_path_factory):
|
||||||
json.dump(account.encrypt(password), open(path, 'x+t'))
|
json.dump(account.encrypt(password), open(path, 'x+t'))
|
||||||
return account, password, keystore
|
return account, password, keystore
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures('mock_contract_agency')
|
||||||
def test_ursula_init_with_local_keystore_signer(click_runner,
|
def test_ursula_init_with_local_keystore_signer(click_runner,
|
||||||
tmp_path,
|
tmp_path,
|
||||||
mocker,
|
mocker,
|
||||||
|
|
|
@ -54,7 +54,7 @@ from tests.utils.config import (
|
||||||
from tests.utils.ursula import MOCK_URSULA_STARTING_PORT
|
from tests.utils.ursula import MOCK_URSULA_STARTING_PORT
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='function')
|
||||||
def mock_contract_agency(monkeypatch, module_mocker, token_economics):
|
def mock_contract_agency(monkeypatch, module_mocker, token_economics):
|
||||||
monkeypatch.setattr(ContractAgency, 'get_agent', MockContractAgency.get_agent)
|
monkeypatch.setattr(ContractAgency, 'get_agent', MockContractAgency.get_agent)
|
||||||
module_mocker.patch.object(EconomicsFactory, 'get_economics', return_value=token_economics)
|
module_mocker.patch.object(EconomicsFactory, 'get_economics', return_value=token_economics)
|
||||||
|
@ -63,42 +63,42 @@ def mock_contract_agency(monkeypatch, module_mocker, token_economics):
|
||||||
mock_agency.reset()
|
mock_agency.reset()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='function')
|
||||||
def mock_token_agent(mock_testerchain, token_economics, mock_contract_agency):
|
def mock_token_agent(mock_testerchain, token_economics, mock_contract_agency):
|
||||||
mock_agent = mock_contract_agency.get_agent(NucypherTokenAgent)
|
mock_agent = mock_contract_agency.get_agent(NucypherTokenAgent)
|
||||||
yield mock_agent
|
yield mock_agent
|
||||||
mock_agent.reset()
|
mock_agent.reset()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='function')
|
||||||
def mock_staking_agent(mock_testerchain, token_economics, mock_contract_agency):
|
def mock_staking_agent(mock_testerchain, token_economics, mock_contract_agency):
|
||||||
mock_agent = mock_contract_agency.get_agent(StakingEscrowAgent)
|
mock_agent = mock_contract_agency.get_agent(StakingEscrowAgent)
|
||||||
yield mock_agent
|
yield mock_agent
|
||||||
mock_agent.reset()
|
mock_agent.reset()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='function')
|
||||||
def mock_adjudicator_agent(mock_testerchain, token_economics, mock_contract_agency):
|
def mock_adjudicator_agent(mock_testerchain, token_economics, mock_contract_agency):
|
||||||
mock_agent = mock_contract_agency.get_agent(AdjudicatorAgent)
|
mock_agent = mock_contract_agency.get_agent(AdjudicatorAgent)
|
||||||
yield mock_agent
|
yield mock_agent
|
||||||
mock_agent.reset()
|
mock_agent.reset()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='function')
|
||||||
def mock_policy_manager_agent(mock_testerchain, token_economics, mock_contract_agency):
|
def mock_policy_manager_agent(mock_testerchain, token_economics, mock_contract_agency):
|
||||||
mock_agent = mock_contract_agency.get_agent(PolicyManagerAgent)
|
mock_agent = mock_contract_agency.get_agent(PolicyManagerAgent)
|
||||||
yield mock_agent
|
yield mock_agent
|
||||||
mock_agent.reset()
|
mock_agent.reset()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='function')
|
||||||
def mock_multisig_agent(mock_testerchain, token_economics, mock_contract_agency):
|
def mock_multisig_agent(mock_testerchain, token_economics, mock_contract_agency):
|
||||||
mock_agent = mock_contract_agency.get_agent(MultiSigAgent)
|
mock_agent = mock_contract_agency.get_agent(MultiSigAgent)
|
||||||
yield mock_agent
|
yield mock_agent
|
||||||
mock_agent.reset()
|
mock_agent.reset()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='function')
|
||||||
def mock_worklock_agent(mock_testerchain, token_economics, mock_contract_agency):
|
def mock_worklock_agent(mock_testerchain, token_economics, mock_contract_agency):
|
||||||
economics = token_economics
|
economics = token_economics
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ def mock_stdin(mocker):
|
||||||
assert mock.empty(), "Stdin mock was not empty on teardown - some unclaimed input remained"
|
assert mock.empty(), "Stdin mock was not empty on teardown - some unclaimed input remained"
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module', autouse=True)
|
@pytest.fixture(scope='module')
|
||||||
def mock_testerchain() -> MockBlockchain:
|
def mock_testerchain() -> MockBlockchain:
|
||||||
BlockchainInterfaceFactory._interfaces = dict()
|
BlockchainInterfaceFactory._interfaces = dict()
|
||||||
testerchain = _make_testerchain(mock_backend=True)
|
testerchain = _make_testerchain(mock_backend=True)
|
||||||
|
@ -146,7 +146,7 @@ def token_economics(mock_testerchain):
|
||||||
return make_token_economics(blockchain=mock_testerchain)
|
return make_token_economics(blockchain=mock_testerchain)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module', autouse=True)
|
@pytest.fixture(scope='module')
|
||||||
def mock_interface(module_mocker):
|
def mock_interface(module_mocker):
|
||||||
mock_transaction_sender = module_mocker.patch.object(BlockchainInterface, 'sign_and_broadcast_transaction')
|
mock_transaction_sender = module_mocker.patch.object(BlockchainInterface, 'sign_and_broadcast_transaction')
|
||||||
mock_transaction_sender.return_value = MockContractAgent.FAKE_RECEIPT
|
mock_transaction_sender.return_value = MockContractAgent.FAKE_RECEIPT
|
||||||
|
@ -167,7 +167,7 @@ def test_registry_source_manager(mock_testerchain, test_registry):
|
||||||
yield real_inventory
|
yield real_inventory
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module', autouse=True)
|
@pytest.fixture(scope='module')
|
||||||
def mock_contract_agency(module_mocker, token_economics):
|
def mock_contract_agency(module_mocker, token_economics):
|
||||||
|
|
||||||
# Patch
|
# Patch
|
||||||
|
|
Loading…
Reference in New Issue