Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SOaAS
psot.repository
Commits
c62b52a7
Commit
c62b52a7
authored
Jan 30, 2018
by
Lukas Jelonek
Browse files
Add test methods for checking whether scripts for repository are resolved correctly.
parent
6cfc2cf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
psot/config.py
View file @
c62b52a7
...
...
@@ -36,7 +36,7 @@ class Repository:
return
os
.
path
.
join
(
self
.
path
,
'config.yaml'
)
def
get_scripts_location
(
self
):
return
pkg_resources
.
resource_filename
(
'psot'
,
'scripts'
)
return
os
.
path
.
join
(
self
.
path
,
'scripts'
)
def
load_config_file
(
self
):
config
=
{}
...
...
@@ -67,6 +67,8 @@ class Repository:
module
[
'analysis'
][
'parameters'
]
=
{}
if
module
[
'converter'
][
'parameters'
]
is
None
:
module
[
'converter'
][
'parameters'
]
=
{}
module
[
'analysis'
][
'script'
]
=
os
.
path
.
join
(
self
.
get_scripts_location
(),
module
[
'analysis'
][
'script'
])
module
[
'converter'
][
'script'
]
=
os
.
path
.
join
(
self
.
get_scripts_location
(),
module
[
'converter'
][
'script'
])
return
modules
def
normalize_profiles
(
self
,
profiles
):
...
...
tests/test_repository.py
View file @
c62b52a7
import
unittest
import
pkg_resources
import
os.path
from
psot
import
config
class
TestExampleRepositoryIsLoadedCorrectly
(
unittest
.
TestCase
):
...
...
@@ -19,8 +20,14 @@ class TestExampleRepositoryIsLoadedCorrectly(unittest.TestCase):
# check that a module with the name 'example' exists in the list of modules
self
.
assertTrue
(
'example'
in
self
.
config
[
'modules'
],
'Module example not found'
)
def
test_that_scripts_are_resolved_correctly
(
self
):
self
.
fail
(
'not implemented yet'
)
def
test_that_run_script_is_resolved_correctly
(
self
):
# all paths to scripts should be stored as absolute paths in the configuration. This tests checks if the scripts are reachable via the path specified
script_path
=
self
.
config
[
'modules'
][
'example'
][
'analysis'
][
'script'
]
self
.
assertTrue
(
os
.
path
.
isfile
(
script_path
),
"Script is not a file "
+
script_path
)
def
test_that_convert_script_is_resolved_correctly
(
self
):
script_path
=
self
.
config
[
'modules'
][
'example'
][
'converter'
][
'script'
]
self
.
assertTrue
(
os
.
path
.
isfile
(
script_path
),
"Script is not a file "
+
script_path
)
def
test_that_config_exists
(
self
):
self
.
fail
(
'not implemented yet
'
)
self
.
assertTrue
(
'tools'
in
self
.
config
,
'config.yml not loaded
'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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