Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbws
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
juga
sbws
Commits
c38cf733
Commit
c38cf733
authored
6 years ago
by
juga
Browse files
Options
Downloads
Plain Diff
Merge branch 'bug28724_01'
parents
fcca7faf
21ce9b69
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sbws/util/config.py
+5
-2
5 additions, 2 deletions
sbws/util/config.py
tests/unit/util/data/user_sbws.ini
+3
-0
3 additions, 0 deletions
tests/unit/util/data/user_sbws.ini
tests/unit/util/test_config.py
+9
-1
9 additions, 1 deletion
tests/unit/util/test_config.py
with
17 additions
and
3 deletions
sbws/util/config.py
+
5
−
2
View file @
c38cf733
...
...
@@ -70,11 +70,14 @@ def _get_user_config(args, conf=None):
# sbws should start with a logger before reading configurations.
print
(
'
Configuration file %s not found, using defaults.
'
%
args
.
config
)
return
conf
return
conf
print
(
'
Using configuration provided as argument %s
'
%
args
.
config
)
return
_extend_config
(
conf
,
args
.
config
)
user_config_path
=
_obtain_user_conf_path
()
if
os
.
path
.
isfile
(
user_config_path
):
print
(
'
Using configuration file %s
'
%
user_config_path
)
return
_extend_config
(
conf
,
user_config_path
)
log
.
debug
(
'
No user config found.
'
)
log
.
debug
(
'
No user config found
, using defaults
.
'
)
return
conf
...
...
This diff is collapsed.
Click to expand it.
tests/unit/util/data/user_sbws.ini
0 → 100644
+
3
−
0
View file @
c38cf733
[paths]
sbws_home
=
/tmp/.sbws
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/unit/util/test_config.py
+
9
−
1
View file @
c38cf733
...
...
@@ -237,4 +237,12 @@ def test_nickname():
def
test_config_arg_provided_but_no_found
(
args
,
conf
):
args
.
config
=
'
non_existing_file
'
con
.
_get_user_config
(
args
,
conf
=
None
)
user_conf
=
con
.
_get_user_config
(
args
,
conf
)
# since the user configuration is not found, it is the same as conf
assert
conf
.
__dict__
.
items
()
==
user_conf
.
__dict__
.
items
()
def
test_config_arg_provided
(
args
,
conf
,
datadir
):
args
.
config
=
datadir
.
join
(
'
user_sbws.ini
'
)
user_conf
=
con
.
_get_user_config
(
args
,
conf
)
assert
user_conf
[
'
paths
'
][
'
sbws_home
'
]
==
'
/tmp/.sbws
'
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