mirror of
https://github.com/gryf/coach.git
synced 2025-12-17 11:10:20 +01:00
Fix golden tests (#199)
* remove unused functions utils.read_json and utils.write_json * increase verbosity of golden tests; detect errors in golden tests
This commit is contained in:
committed by
Scott Leishman
parent
fedb4cbd7c
commit
8672f8b542
@@ -100,7 +100,7 @@ def preset_name(request):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.golden_test
|
@pytest.mark.golden_test
|
||||||
def test_preset_reward(preset_name, no_progress_bar=False, time_limit=60 * 60, verbose=False):
|
def test_preset_reward(preset_name, no_progress_bar=True, time_limit=60 * 60, verbose=True):
|
||||||
preset_validation_params = validation_params(preset_name)
|
preset_validation_params = validation_params(preset_name)
|
||||||
|
|
||||||
win_size = 10
|
win_size = 10
|
||||||
@@ -221,7 +221,8 @@ def test_preset_reward(preset_name, no_progress_bar=False, time_limit=60 * 60, v
|
|||||||
|
|
||||||
shutil.rmtree(test_path)
|
shutil.rmtree(test_path)
|
||||||
os.remove(log_file_name)
|
os.remove(log_file_name)
|
||||||
return test_passed
|
if not test_passed:
|
||||||
|
raise ValueError('golden test failed')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -278,8 +279,9 @@ def main():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
test_count += 1
|
test_count += 1
|
||||||
test_passed = test_preset_reward(preset_name, args.no_progress_bar, args.time_limit, args.verbose)
|
try:
|
||||||
if not test_passed:
|
test_preset_reward(preset_name, args.no_progress_bar, args.time_limit, args.verbose)
|
||||||
|
except Exception as e:
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
|
|
||||||
screen.separator()
|
screen.separator()
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
import importlib
|
import importlib
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import inspect
|
import inspect
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import signal
|
import signal
|
||||||
@@ -85,19 +84,6 @@ def is_empty(str):
|
|||||||
return str == 0 or len(str.replace("'", "").replace("\"", "")) == 0
|
return str == 0 or len(str.replace("'", "").replace("\"", "")) == 0
|
||||||
|
|
||||||
|
|
||||||
def read_json(filename):
|
|
||||||
# read json file
|
|
||||||
with open(filename, 'r') as f:
|
|
||||||
dict = json.loads(f.read())
|
|
||||||
return dict
|
|
||||||
|
|
||||||
|
|
||||||
def write_json(filename, dict):
|
|
||||||
# read json file
|
|
||||||
with open(filename, 'w') as f:
|
|
||||||
f.write(json.dumps(dict, indent=4))
|
|
||||||
|
|
||||||
|
|
||||||
def path_is_valid_dir(path):
|
def path_is_valid_dir(path):
|
||||||
return os.path.isdir(path)
|
return os.path.isdir(path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user