Commit c62b52a7 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add test methods for checking whether scripts for repository are resolved correctly.

parent 6cfc2cf4
......@@ -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):
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):'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):'not implemented yet')
self.assertTrue('tools' in self.config, 'config.yml not loaded')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment