Stop running tests from tests/unit 67/58767/10
authorEmma Foley <emma.l.foley@intel.com>
Tue, 20 Feb 2018 16:19:50 +0000 (16:19 +0000)
committerEmma Foley <emma.l.foley@intel.com>
Tue, 26 Jun 2018 14:39:59 +0000 (14:39 +0000)
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>
(cherry-picked from commit 64add9a435e9455b3bff6971d2717857cdce8193)

tests/unit/__init__.py [deleted file]
tests/unit/network_services/__init__.py [deleted file]
tools/cover.sh
tools/run_tests.sh
yardstick/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py

diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
deleted file mode 100644 (file)
index 95b2b8a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2017 Intel Corporation\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-#      http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-\r
-import sys\r
-\r
-import mock\r
-\r
-from yardstick import tests\r
-\r
-# NOTE(ralonsoh): to be removed. Replace all occurrences of\r
-# tests.unit.STL_MOCKS with yardstick.tests.STL_MOCKS\r
-STL_MOCKS = tests.STL_MOCKS\r
-\r
-mock_stl = mock.patch.dict(sys.modules, tests.STL_MOCKS)\r
-mock_stl.start()\r
diff --git a/tests/unit/network_services/__init__.py b/tests/unit/network_services/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
index c6e928d..4e54a64 100644 (file)
@@ -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
index 32c4f19..49f628e 100755 (executable)
@@ -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
 
index d29642a..82376a4 100644 (file)
@@ -18,19 +18,13 @@ import os
 import unittest
 import mock
 
-from tests.unit import STL_MOCKS
 from yardstick.tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
 from yardstick.common import utils
 
-STLClient = mock.MagicMock()
-stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
-stl_patch.start()
-
-if stl_patch:
-    from yardstick.network_services.vnf_generic.vnf.cgnapt_vnf import CgnaptApproxVnf, \
-        CgnaptApproxSetupEnvHelper
-    from yardstick.network_services.vnf_generic.vnf import cgnapt_vnf
-    from yardstick.network_services.nfvi.resource import ResourceProfile
+from yardstick.network_services.vnf_generic.vnf.cgnapt_vnf import CgnaptApproxVnf, \
+    CgnaptApproxSetupEnvHelper
+from yardstick.network_services.vnf_generic.vnf import cgnapt_vnf
+from yardstick.network_services.nfvi.resource import ResourceProfile
 
 TEST_FILE_YAML = 'nsb_test_case.yaml'
 SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
index 5bebbbf..59594a3 100644 (file)
 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()