Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
python-handel
Commits
760470ab
Commit
760470ab
authored
Aug 30, 2017
by
Vincent Michel
Browse files
Do not ignore non-existing files
parent
1bf1bb85
Pipeline
#890
failed with stages
in 1 minute and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
handel/interface.py
View file @
760470ab
...
...
@@ -363,7 +363,11 @@ def get_config_files(path):
def
get_config
(
filename
):
"""Read and return the given config file as a dictionary."""
# Make sure the file exists
open
(
filename
).
close
()
# Customize parser
config
=
configparser
.
ConfigParser
(
comment_prefixes
=
[
'START'
,
'END'
,
'#'
,
'*****'
])
# Read and parse
config
.
read
(
filename
)
return
{
section
:
dict
(
config
[
section
])
for
section
in
config
.
sections
()}
tests/test_interface.py
View file @
760470ab
...
...
@@ -469,3 +469,5 @@ def test_get_config(interface):
d
=
interface
.
get_config
(
filename
)
assert
d
[
'detector definitions'
][
'alias'
]
==
'detector1'
assert
'DEFAULT'
not
in
d
with
pytest
.
raises
(
FileNotFoundError
):
interface
.
get_config
(
'i_dont_exist.ini'
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment