Skip qt tests on missing brokers.ini entry
parent
eaa2a9b05d
commit
e1d6edb3ee
|
@ -1,6 +1,12 @@
|
|||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def brokerconf():
|
||||
from piker.brokers import config
|
||||
return config.load()[0]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def us_symbols():
|
||||
return ['TSLA', 'AAPL', 'CGC', 'CRON']
|
||||
|
|
|
@ -6,6 +6,15 @@ import time
|
|||
import trio
|
||||
from trio.testing import trio_test
|
||||
from piker.brokers import questrade as qt
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def check_qt_conf_section(brokerconf):
|
||||
"""Skip this module's tests if we have not quetrade API creds.
|
||||
"""
|
||||
if not brokerconf.has_section('questrade'):
|
||||
pytest.skip("No questrade API credentials available")
|
||||
|
||||
|
||||
# stock quote
|
||||
|
@ -66,7 +75,6 @@ _ex_contract = {
|
|||
}
|
||||
|
||||
|
||||
|
||||
def match_packet(symbols, quotes):
|
||||
"""Verify target ``symbols`` match keys in ``quotes`` packet.
|
||||
"""
|
||||
|
@ -158,7 +166,7 @@ async def test_option_quote_latency(tmx_symbols):
|
|||
for _ in range(10):
|
||||
# chains quote for all symbols
|
||||
start = time.time()
|
||||
quotes = await client.option_chains(contract)
|
||||
await client.option_chains(contract)
|
||||
took = time.time() - start
|
||||
print(f"Request took {took}")
|
||||
assert took <= expected_latency
|
||||
|
|
Loading…
Reference in New Issue