Skip to content

Commit 8254cfa

Browse files
committed
Improve validation error
1 parent 5370a52 commit 8254cfa

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tests/integration/template_complete_run.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ www = "#expand user_www#zppy_test_complete_run_www"
1313
[climo]
1414
active = True
1515
walltime = "00:30:00"
16-
years = "1850:1854:2", "1850:1854:4",
16+
years = "1850:1854:2", "1850:1854:4"
1717

1818
[[ atm_monthly_180x360_aave ]]
1919
frequency = "monthly"
@@ -25,9 +25,9 @@ years = "1850:1854:2", "1850:1854:4",
2525
vars = "PRECT"
2626

2727
[ts]
28-
active = True
28+
active = 4
2929
walltime = "00:30:00"
30-
years = "1850:1854:2",
30+
years = "1850:1854:2"
3131

3232
[[ atm_monthly_180x360_aave ]]
3333
frequency = "monthly"

zppy/__main__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import errno
33
import os
4+
import pprint
45
from typing import List
56

67
from configobj import ConfigObj
@@ -167,8 +168,12 @@ def _validate_config(config):
167168
validator = Validator()
168169

169170
result = config.validate(validator)
171+
print(type(result))
170172
if result is not True:
171-
print("Validation results={}".format(result))
173+
printer = pprint.PrettyPrinter(depth=3)
174+
print("Validation results:")
175+
printer.pprint(result)
176+
# print("Validation results={}".format(result))
172177
raise ValueError(
173178
"Configuration file validation failed. Parameters listed as false in the validation results have invalid values."
174179
)

0 commit comments

Comments
 (0)