Tox utility to run unit tests 71/33671/10
authorashishk1994 <ashishk.iiit@gmail.com>
Sat, 22 Apr 2017 16:40:31 +0000 (22:10 +0530)
committerCédric Ollivier <cedric.ollivier@orange.com>
Sat, 20 May 2017 10:16:12 +0000 (12:16 +0200)
Now run_unit_tests.sh only calls tox to allow merging.
It can be safely deleted as soon as the related jjob is updated.

It also removes test_logging.ini.

Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com>
Change-Id: I934f4ac739d99d0cb29bea8c6aac6d6780b30901
Signed-off-by: ashishk1994 <ashishk.iiit@gmail.com>
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/tests/unit/test_logging.ini [deleted file]
run_unit_tests.sh
tox.ini [new file with mode: 0644]

diff --git a/functest/tests/unit/test_logging.ini b/functest/tests/unit/test_logging.ini
deleted file mode 100644 (file)
index 492767d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-[loggers]
-keys=root,functest_logger
-
-[logger_root]
-level=DEBUG
-handlers=console
-
-[logger_functest_logger]
-level=DEBUG
-handlers=console
-qualname=functest.utils.functest_logger
-propagate=0
-
-[handlers]
-keys=console
-
-[handler_console]
-class=StreamHandler
-level=INFO
-formatter=standard
-args=(sys.stdout,)
-
-[formatters]
-keys=standard
-
-[formatter_standard]
-format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
\ No newline at end of file
index 3eb2cda..31a95f4 100755 (executable)
@@ -1,42 +1,5 @@
 #!/bin/bash
-set -o errexit
-set -o pipefail
 
-# Either Workspace is set (CI)
-if [ -z $WORKSPACE ]
-then
-    WORKSPACE=`pwd`
-fi
-
-
-# ***************
-# Run unit tests
-# ***************
-echo "Running unit tests..."
-
-sudo apt-get install -y build-essential python-dev python-pip
-sudo pip install virtualenv==15.1.0
-
-# start vitual env
-virtualenv $WORKSPACE/functest_venv
-source $WORKSPACE/functest_venv/bin/activate
-
-# install python packages
-pip install --upgrade pip
-pip install -r $WORKSPACE/requirements.txt
-pip install -r $WORKSPACE/test-requirements.txt
-pip install $WORKSPACE
-
-nosetests --with-xunit \
-         --with-coverage \
-         --cover-tests \
-         --cover-package=functest \
-         --cover-xml \
-         --cover-html \
-         --log-config=$(pwd)/functest/tests/unit/test_logging.ini \
-         functest/tests/unit
-rc=$?
-
-deactivate
+tox
 
 exit $rc
diff --git a/tox.ini b/tox.ini
new file mode 100644 (file)
index 0000000..d7da122
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,14 @@
+[tox]
+envlist = py27
+
+[testenv]
+deps =
+  -r{toxinidir}/requirements.txt
+  -r{toxinidir}/test-requirements.txt
+commands = nosetests --with-xunit \
+  --with-coverage \
+  --cover-tests \
+  --cover-package=functest \
+  --cover-xml \
+  --cover-html \
+  functest/tests/unit