Merge "Run unittests via tox"

This commit is contained in:
Jenkins 2016-07-25 11:02:58 +00:00 committed by Gerrit Code Review
commit 95f75bcbce
4 changed files with 14 additions and 14 deletions

5
.gitignore vendored
View File

@ -37,5 +37,8 @@ tools/lintstack.head.py
tools/pylint_exceptions tools/pylint_exceptions
*.zip *.zip
#Linux swap file # Linux swap file
*.swp *.swp
# Tests results
.tox

View File

@ -31,3 +31,7 @@ deps=
ipdb ipdb
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = python -m unittest tests.test_cicd_apps.MuranoCiCdTest.test_deploy_cicd commands = python -m unittest tests.test_cicd_apps.MuranoCiCdTest.test_deploy_cicd
[testenv:units]
# FIXME!
commands = python -m unittest unittests.test_namespaces.TestNamespaces.test_namespaces

0
unittests/__init__.py Normal file
View File

View File

@ -2,8 +2,10 @@ import os
import re import re
import yaml import yaml
import testtools
class TestNamespaces():
class TestNamespaces(testtools.TestCase):
def get_list_of_classes(self): def get_list_of_classes(self):
# TODO: should be fixed future with some common approach for all tests # TODO: should be fixed future with some common approach for all tests
root_dir = os.path.dirname(os.path.abspath(__file__)).rsplit('/', 1)[0] root_dir = os.path.dirname(os.path.abspath(__file__)).rsplit('/', 1)[0]
@ -63,16 +65,7 @@ class TestNamespaces():
for ns in self.get_namespaces(cls_name): for ns in self.get_namespaces(cls_name):
self.check_name(ns, cls_name, error_list) self.check_name(ns, cls_name, error_list)
if error_list: error_string = "\n".join(error_list)
error_string = "\n".join(error_list) msg = "Test detects follow list of errors: \n%s" % error_string
msg = "Test detects follow list of errors: \n%s" % error_string
raise ValueError(msg)
self.assertEqual(0, len(error_list), msg)
def main():
test = TestNamespaces()
test.test_namespaces()
# to run test just execute command:
# python unittests/test_namespaces.py
main()