diff options
author | xudan <xudan16@huawei.com> | 2016-12-05 08:28:20 +0000 |
---|---|---|
committer | xudan <xudan16@huawei.com> | 2016-12-05 08:38:22 +0000 |
commit | aa6e0b06aa404557bfe653746bc7c3f62a81f705 (patch) | |
tree | a4ee80fb278c8161151cc8497cdb58cb03e55ea8 /unittests | |
parent | ec43484e1c8c8123a0e45c78d6fcb5a8d5560b43 (diff) |
dovetail tool: add unit test into script unittest.sh
1. Since JIRA: DOVETAIL-55 has been merged, unit tests can't pass without
load_config_files().
2. Fix the bug by adding load_config_files().
3. Add run_tests() into script unittest.sh to include all unit tests in
tests/unit.
JIRA: DOVETAIL-149
Change-Id: I7bdb0732fefde3a3f3b82441b4cc7e46ece66a1e
Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'unittests')
-rwxr-xr-x | unittests/unittest.sh | 22 |
1 files changed, 22 insertions, 0 deletions
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 |