Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
f3ba807d
Commit
f3ba807d
authored
4 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
STY: style fixes and cleanup of unnecessary imports
parent
1961fc0a
No related branches found
No related tags found
2 merge requests
!33
MAINT: change arguments of create_user
,
!21
ENH: add json schema validation for config files
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosdb/configuration.py
+2
-1
2 additions, 1 deletion
src/caosdb/configuration.py
unittests/test_schema.py
+1
-2
1 addition, 2 deletions
unittests/test_schema.py
with
3 additions
and
3 deletions
src/caosdb/configuration.py
+
2
−
1
View file @
f3ba807d
...
...
@@ -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
"
])
This diff is collapsed.
Click to expand it.
unittests/test_schema.py
+
1
−
2
View file @
f3ba807d
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment