From 91e91fd6b5517cc55e60a8c93d19bb6a429b2bff Mon Sep 17 00:00:00 2001 From: tuxxy Date: Fri, 13 Apr 2018 18:34:48 -0600 Subject: [PATCH] Add tester_registrar and tester_provider pytest fixtures --- tests/eth_fixtures.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/eth_fixtures.py b/tests/eth_fixtures.py index f30e30c6c..c94e613f3 100644 --- a/tests/eth_fixtures.py +++ b/tests/eth_fixtures.py @@ -1,16 +1,33 @@ +import os import pytest +import tempfile from nkms.blockchain.eth.agents import NuCypherKMSTokenAgent, MinerAgent from nkms.blockchain.eth.agents import PolicyAgent from nkms.blockchain.eth.chains import TheBlockchain, TesterBlockchain from nkms.blockchain.eth.deployers import PolicyManagerDeployer, NuCypherKMSTokenDeployer from nkms.blockchain.eth.utilities import MockMinerEscrowDeployer +from nkms.blockchain.eth.interfaces import Registrar, Provider @pytest.fixture(scope='session') -def chain(): +def tester_registrar(): + _, filepath = tempfile.mkstemp() + tester_registrar = Registrar(chain_name='tester', registrar_filepath=filepath) + yield tester_registrar + os.remove(filepath) - testerchain = TesterBlockchain() + +@pytest.fixture(scope='session') +def tester_provider(tester_registrar): + tester_provider = Provider(registrar=tester_registrar) + yield tester_provider + + +@pytest.fixture(scope='session') +def chain(tester_provider): + + testerchain = TesterBlockchain(provider=tester_provider) yield testerchain del testerchain