aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2018-02-20 16:19:50 +0000
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-06-18 08:42:19 +0000
commit64add9a435e9455b3bff6971d2717857cdce8193 (patch)
treedfed47f85e721f47773b2cda47e3061813a26664
parentf4c002a5b95ad157c88825748f891c7adc1bbe04 (diff)
Stop running tests from tests/unit
Since all tests have been moved into yardstick/tests, temperary code to run tests in both tests and yardstick/tests should be removed. JIRA: YARDSTICK-837 Change-Id: I3bf3c9ece9bc8457d992e53ee8cc5cadb1dec8f0 Signed-off-by: Emma Foley <emma.l.foley@intel.com>
-rw-r--r--tests/unit/__init__.py26
-rw-r--r--tests/unit/network_services/__init__.py0
-rw-r--r--tools/cover.sh11
-rwxr-xr-xtools/run_tests.sh11
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py2
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py4
6 files changed, 7 insertions, 47 deletions
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
deleted file mode 100644
index 95b2b8a4e..000000000
--- a/tests/unit/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2017 Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-
-import mock
-
-from yardstick import tests
-
-# NOTE(ralonsoh): to be removed. Replace all occurrences of
-# tests.unit.STL_MOCKS with yardstick.tests.STL_MOCKS
-STL_MOCKS = tests.STL_MOCKS
-
-mock_stl = mock.patch.dict(sys.modules, tests.STL_MOCKS)
-mock_stl.start()
diff --git a/tests/unit/network_services/__init__.py b/tests/unit/network_services/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/unit/network_services/__init__.py
+++ /dev/null
diff --git a/tools/cover.sh b/tools/cover.sh
index c6e928d1a..4e54a64b7 100644
--- a/tools/cover.sh
+++ b/tools/cover.sh
@@ -44,14 +44,12 @@ run_coverage_test() {
baseline_report=$(mktemp -t yardstick_coverageXXXXXXX)
find . -type f -name "*.pyc" -delete
+ coverage erase
- # Temporarily run tests from two directories, until all tests have moved
- coverage run -p -m unittest discover ./tests/unit
coverage run -p -m unittest discover ./yardstick/tests/unit
coverage combine
- # Temporarily omit yardstick/tests from the report
- coverage report --omit=yardstick/tests/*/* > ${baseline_report}
+ coverage report > ${baseline_report}
coverage erase
# debug awk
@@ -72,13 +70,10 @@ run_coverage_test() {
find . -type f -name "*.pyc" -delete
- # Temporarily run tests from two directories, until all tests have moved
- coverage run -p -m unittest discover ./tests/unit
coverage run -p -m unittest discover ./yardstick/tests/unit
coverage combine
- # Temporarily omit yardstick/tests from the report
- coverage report --omit=yardstick/tests/*/* > ${current_report}
+ coverage report > ${current_report}
coverage erase
rm -rf cover-$PY_VER
diff --git a/tools/run_tests.sh b/tools/run_tests.sh
index 32c4f19e4..49f628eec 100755
--- a/tools/run_tests.sh
+++ b/tools/run_tests.sh
@@ -28,17 +28,8 @@ run_tests() {
echo "Running unittest ... "
if [ $FILE_OPTION == "f" ]; then
- python -m unittest discover -v -s tests/unit > $logfile 2>&1
- if [ $? -ne 0 ]; then
- echo "FAILED, results in $logfile"
- exit 1
- fi
- python -m unittest discover -v -s yardstick/tests/unit >> $logfile 2>&1
+ python -m unittest discover -v -s yardstick/tests/unit > $logfile 2>&1
else
- python -m unittest discover -v -s tests/unit
- if [ $? -ne 0 ]; then
- exit 1
- fi
python -m unittest discover -v -s yardstick/tests/unit
fi
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py b/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
index 5fe1b7326..7111c8075 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
@@ -18,8 +18,8 @@ import mock
import six
import unittest
-from yardstick.tests import STL_MOCKS
from yardstick.common import exceptions as y_exc
+from yardstick.tests import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
index 5bebbbf94..59594a3c3 100644
--- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
+++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
@@ -16,12 +16,12 @@
import subprocess
import mock
-import unittest
import six
+import unittest
-from yardstick.tests import STL_MOCKS
from yardstick import ssh
from yardstick.common import utils
+from yardstick.tests import STL_MOCKS
STLClient = mock.MagicMock()