Run unittests via tox

- Add "units" section to tox.ini file
- Add .tox to ignore file to ignore results of tests by git
- Fix unittest to use unittests library

Change-Id: Icffc9211eff2f6f54e24369b11a7c4c45b3dda98
This commit is contained in:
Sergey Kraynev 2016-07-21 11:45:41 +03:00
parent 0812b03d57
commit a43eaa4d43
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
*.zip
#Linux swap file
# Linux swap file
*.swp
# Tests results
.tox

View File

@ -31,3 +31,7 @@ deps=
ipdb
-r{toxinidir}/test-requirements.txt
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 yaml
import testtools
class TestNamespaces():
class TestNamespaces(testtools.TestCase):
def get_list_of_classes(self):
# TODO: should be fixed future with some common approach for all tests
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):
self.check_name(ns, cls_name, error_list)
if error_list:
error_string = "\n".join(error_list)
msg = "Test detects follow list of errors: \n%s" % error_string
raise ValueError(msg)
error_string = "\n".join(error_list)
msg = "Test detects follow list of errors: \n%s" % error_string
def main():
test = TestNamespaces()
test.test_namespaces()
# to run test just execute command:
# python unittests/test_namespaces.py
main()
self.assertEqual(0, len(error_list), msg)