Skip to content
Snippets Groups Projects
Commit f3ba807d authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

STY: style fixes and cleanup of unnecessary imports

parent 1961fc0a
No related branches found
No related tags found
2 merge requests!33MAINT: change arguments of create_user,!21ENH: add json schema validation for config files
......@@ -53,6 +53,7 @@ def configure(inifile):
validate_yaml_schema(config_to_yaml(_pycaosdbconf))
return read_config
def get_config():
return _pycaosdbconf
......@@ -72,8 +73,8 @@ def config_to_yaml(config):
return valobj
def validate_yaml_schema(valobj):
with open(os.path.join(os.path.dirname(__file__), "schema-pycaosdb-ini.yml")) as f:
schema = yaml.load(f, Loader=yaml.SafeLoader)
validate(instance=valobj, schema=schema["schema-pycaosdb-ini"])
......@@ -2,8 +2,6 @@
# Test configuration schema
# A. Schlemmer, 01/2021
import yaml
from jsonschema import validate
from jsonschema.exceptions import ValidationError
from pytest import raises
from glob import glob
......@@ -18,6 +16,7 @@ def test_config_files():
c.read(fn)
validate_yaml_schema(config_to_yaml(c))
def test_broken_config_files():
for fn in glob(os.path.join(os.path.dirname(__file__), "broken_configs", "*.ini")):
print(fn)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment