summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dovetail/container.py3
-rw-r--r--dovetail/tests/unit/test_parser.py5
-rwxr-xr-xunittests/unittest.sh22
3 files changed, 26 insertions, 4 deletions
diff --git a/dovetail/container.py b/dovetail/container.py
index 2716a089..a0cdf657 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -41,12 +41,11 @@ class Container:
@classmethod
def create(cls, type):
- # sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa "
+ sshkey = "-v /root/.ssh/id_rsa:/root/.ssh/id_rsa "
dovetail_config = dt_config.dovetail_config
docker_image = cls.get_docker_image(type)
envs = dovetail_config[type]['envs']
opts = dovetail_config[type]['opts']
- sshkey = ''
result_volume = ' -v %s:%s ' % (dovetail_config['result_dir'],
dovetail_config[type]['result']['dir'])
cmd = 'sudo docker run %s %s %s %s %s /bin/bash' % \
diff --git a/dovetail/tests/unit/test_parser.py b/dovetail/tests/unit/test_parser.py
index b4331ea1..2183bd60 100644
--- a/dovetail/tests/unit/test_parser.py
+++ b/dovetail/tests/unit/test_parser.py
@@ -14,7 +14,6 @@ Test 'parser' module
import logging
import os
import unittest
-
import yaml
import parser as dovetail_parser
@@ -26,8 +25,10 @@ class TestParser(unittest.TestCase):
def setUp(self):
"""Test case setup"""
- logging.disable(logging.CRITICAL)
+ from conf.dovetail_config import DovetailConfig as dt_config
+ dt_config.load_config_files()
dovetail_parser.Parser.create_log()
+ logging.disable(logging.CRITICAL)
def test_parser_cmd(self):
"""Test whether the command is correctly parsed."""
diff --git a/unittests/unittest.sh b/unittests/unittest.sh
index 1560a90d..215d0ebd 100755
--- a/unittests/unittest.sh
+++ b/unittests/unittest.sh
@@ -35,4 +35,26 @@ run_flake8() {
fi
}
+run_tests() {
+ echo "Running unittest ..."
+ cd dovetail/
+ if [ $FILE_OPTION == "f" ]; then
+ python -m unittest discover -v -s tests/unit > $logfile 2>&1
+ else
+ python -m unittest discover -v -s tests/unit
+ fi
+
+ if [ $? -ne 0 ]; then
+ if [ $FILE_OPTION == "f" ]; then
+ echo "FAILED, results in $logfile"
+ fi
+ exit 1
+ else
+ if [ $FILE_OPTION == "f" ]; then
+ echo "OK, results in $logfile"
+ fi
+ fi
+}
+
run_flake8
+run_tests