From dbedb36db63b406c5264be20e100062fc59c5a19 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Ollivier?= Date: Tue, 23 May 2017 16:37:04 +0200 Subject: [PATCH] Rename pytest_suite_runner.py to unit.py MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It also adds the rst files to include this module in apidoc. Change-Id: Iabbb17bc8601265bd9436c75d1afc0b470df1eb4 Signed-off-by: Cédric Ollivier --- docs/api/apidoc/functest.core.rst | 1 + docs/api/apidoc/functest.core.unit.rst | 7 +++++++ functest/core/{pytest_suite_runner.py => unit.py} | 0 functest/opnfv_tests/openstack/snaps/snaps_test_runner.py | 4 ++-- functest/tests/unit/core/test_pytest_suite_runner.py | 10 ++++------ 5 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 docs/api/apidoc/functest.core.unit.rst rename functest/core/{pytest_suite_runner.py => unit.py} (100%) diff --git a/docs/api/apidoc/functest.core.rst b/docs/api/apidoc/functest.core.rst index 27b2ed1fb..55c795be0 100644 --- a/docs/api/apidoc/functest.core.rst +++ b/docs/api/apidoc/functest.core.rst @@ -14,4 +14,5 @@ Submodules functest.core.feature functest.core.testcase functest.core.vnf + functest.core.unit diff --git a/docs/api/apidoc/functest.core.unit.rst b/docs/api/apidoc/functest.core.unit.rst new file mode 100644 index 000000000..5dd6880ed --- /dev/null +++ b/docs/api/apidoc/functest.core.unit.rst @@ -0,0 +1,7 @@ +functest.core.unit module +========================= + +.. automodule:: functest.core.unit + :members: + :undoc-members: + :show-inheritance: diff --git a/functest/core/pytest_suite_runner.py b/functest/core/unit.py similarity index 100% rename from functest/core/pytest_suite_runner.py rename to functest/core/unit.py diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index 94b97551a..c180df619 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -7,7 +7,7 @@ import logging -from functest.core.pytest_suite_runner import PyTestSuiteRunner +from functest.core import unit from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.utils import functest_utils from functest.utils.constants import CONST @@ -16,7 +16,7 @@ from snaps.openstack import create_flavor from snaps.openstack.tests import openstack_tests -class SnapsTestRunner(PyTestSuiteRunner): +class SnapsTestRunner(unit.PyTestSuiteRunner): """ This test executes the SNAPS Python Tests """ diff --git a/functest/tests/unit/core/test_pytest_suite_runner.py b/functest/tests/unit/core/test_pytest_suite_runner.py index f317cdea2..c11d8853e 100644 --- a/functest/tests/unit/core/test_pytest_suite_runner.py +++ b/functest/tests/unit/core/test_pytest_suite_runner.py @@ -12,20 +12,19 @@ import unittest import mock -from functest.core import pytest_suite_runner +from functest.core import unit from functest.core import testcase class PyTestSuiteRunnerTesting(unittest.TestCase): def setUp(self): - self.psrunner = pytest_suite_runner.PyTestSuiteRunner() + self.psrunner = unit.PyTestSuiteRunner() @mock.patch('unittest.TestLoader') def _test_run(self, mock_class=None, result=mock.Mock(), status=testcase.TestCase.EX_OK): - with mock.patch('functest.core.pytest_suite_runner.' - 'unittest.TextTestRunner.run', + with mock.patch('functest.core.unit.unittest.TextTestRunner.run', return_value=result): self.assertEqual(self.psrunner.run(), status) mock_class.assert_not_called() @@ -78,8 +77,7 @@ class PyTestSuiteRunnerTesting(unittest.TestCase): failures=[]) mock_obj = mock.Mock() mock_class.side_effect = mock_obj - with mock.patch('functest.core.pytest_suite_runner.' - 'unittest.TextTestRunner.run', + with mock.patch('functest.core.unit.unittest.TextTestRunner.run', return_value=mock_result): self.assertEqual(self.psrunner.run(name='foo'), testcase.TestCase.EX_OK) -- 2.16.6