Fixes test to work with session fixtures

Test were running fine standalone but failing / having Address reuse issues when running all together. Fixing that.
This commit is contained in:
Sergi Delgado Segura
2019-10-14 13:00:21 +01:00
parent e5ab943f8c
commit abe359f7d1
5 changed files with 11 additions and 84 deletions

View File

@@ -4,14 +4,12 @@ import pytest
import time
import requests
from hashlib import sha256
from threading import Thread
from binascii import unhexlify
from apps.cli.blob import Blob
from pisa.api import start_api
from pisa import HOST, PORT, logging
from pisa.utils.auth_proxy import AuthServiceProxy
from test.simulator.bitcoind_sim import run_simulator, TIME_BETWEEN_BLOCKS
from test.simulator.bitcoind_sim import TIME_BETWEEN_BLOCKS
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, MAX_APPOINTMENTS
logging.getLogger().disabled = True
@@ -46,23 +44,6 @@ def generate_dummy_appointment(dispute_txid):
return appointment
@pytest.fixture(autouse=True, scope='session')
def run_api():
api_thread = Thread(target=start_api)
api_thread.daemon = True
api_thread.start()
# It takes a little bit of time to start the API (otherwise the requests are sent too early and they fail)
time.sleep(0.1)
@pytest.fixture(autouse=True, scope='session')
def run_bitcoind():
bitcoind_thread = Thread(target=run_simulator)
bitcoind_thread.daemon = True
bitcoind_thread.start()
@pytest.fixture
def new_appointment(dispute_txid=None):
appointment = create_appointment(dispute_txid)