Merge pull request #5070 from janoskut/test-pairlist-remove-non-json-headline

test-pairlist: remove non-JSON headline from JSON output
This commit is contained in:
Matthias 2021-06-03 05:39:50 +01:00 committed by GitHub
commit 8f4700e690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 results[curr] = pairlists.whitelist
for curr, pairlist in results.items(): 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}: ") print(f"Pairs for {curr}: ")
if args.get('print_one_column', False): if args.get('print_one_column', False):

View File

@ -1,3 +1,4 @@
import json
import re import re
from io import BytesIO from io import BytesIO
from pathlib import Path 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)) start_test_pairlist(get_args(args))
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match(r'Pairs for BTC: \n\["ETH/BTC","TKN/BTC","BLK/BTC","LTC/BTC","XRP/BTC"\]\n', try:
captured.out) 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, def test_hyperopt_list(mocker, capsys, caplog, saved_hyperopt_results,