test-pairlist: remove non-JSON headline from JSON output

This commit is contained in:
Janos 2021-06-02 20:50:08 +02:00
parent 3dab58e6db
commit 80af6e43e4
2 changed files with 11 additions and 3 deletions

View File

@ -31,7 +31,7 @@ def start_test_pairlist(args: Dict[str, Any]) -> None:
results[curr] = pairlists.whitelist
for curr, pairlist in results.items():
if not args.get('print_one_column', False):
if not args.get('print_one_column', False) and not args.get('list_pairs_print_json', False):
print(f"Pairs for {curr}: ")
if args.get('print_one_column', False):

View File

@ -1,3 +1,4 @@
import json
import re
from io import BytesIO
from pathlib import Path
@ -914,8 +915,15 @@ def test_start_test_pairlist(mocker, caplog, tickers, default_conf, capsys):
]
start_test_pairlist(get_args(args))
captured = capsys.readouterr()
assert re.match(r'Pairs for BTC: \n\["ETH/BTC","TKN/BTC","BLK/BTC","LTC/BTC","XRP/BTC"\]\n',
captured.out)
try:
json_pairs = json.loads(captured.out)
assert 'ETH/BTC' in json_pairs
assert 'TKN/BTC' in json_pairs
assert 'BLK/BTC' in json_pairs
assert 'LTC/BTC' in json_pairs
assert 'XRP/BTC' in json_pairs
except json.decoder.JSONDecodeError:
pytest.fail(f'Expected well formed JSON, but failed to parse: {captured.out}')
def test_hyperopt_list(mocker, capsys, caplog, saved_hyperopt_results,