From 6d361c6804b85b870add58b5b4a6c7df8e9476d4 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 3 Jan 2017 08:30:51 +0100 Subject: Patch logging.FileHandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It avoids creating a dummy functest.log for unit testing. Change-Id: Ib163d5d58284822b1904444fb60b08e92ee0ab9b Signed-off-by: Cédric Ollivier --- functest/tests/unit/cli/commands/test_cli_env.py | 1 + functest/tests/unit/core/test_testcase_base.py | 1 + functest/tests/unit/odl/test_odl.py | 1 + functest/tests/unit/utils/test_functest_utils.py | 1 + run_unit_tests.sh | 3 --- 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/functest/tests/unit/cli/commands/test_cli_env.py b/functest/tests/unit/cli/commands/test_cli_env.py index 4b6ea57a7..f70761dcd 100644 --- a/functest/tests/unit/cli/commands/test_cli_env.py +++ b/functest/tests/unit/cli/commands/test_cli_env.py @@ -11,6 +11,7 @@ import unittest from git.exc import NoSuchPathError import mock +mock.patch('logging.FileHandler').start() # noqa from functest.cli.commands import cli_env from functest.utils.constants import CONST from functest.tests.unit import test_utils diff --git a/functest/tests/unit/core/test_testcase_base.py b/functest/tests/unit/core/test_testcase_base.py index b7c81d87c..b6efa40dc 100644 --- a/functest/tests/unit/core/test_testcase_base.py +++ b/functest/tests/unit/core/test_testcase_base.py @@ -11,6 +11,7 @@ import logging import mock import unittest +mock.patch('logging.FileHandler').start() # noqa from functest.core import testcase_base diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index d8c7f84ec..4430c3b84 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -17,6 +17,7 @@ from keystoneauth1.exceptions import auth_plugins from robot.errors import RobotError from robot.result import testcase +mock.patch('logging.FileHandler').start() # noqa from functest.core import testcase_base from functest.opnfv_tests.sdn.odl import odl diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py index ce9086a7a..c4b566608 100644 --- a/functest/tests/unit/utils/test_functest_utils.py +++ b/functest/tests/unit/utils/test_functest_utils.py @@ -18,6 +18,7 @@ import mock import requests from functest.tests.unit import test_utils +mock.patch('logging.FileHandler').start() # noqa from functest.utils import functest_utils diff --git a/run_unit_tests.sh b/run_unit_tests.sh index e0e6195cb..edce03c16 100755 --- a/run_unit_tests.sh +++ b/run_unit_tests.sh @@ -21,10 +21,7 @@ clean_results_dir # TODO clean that... # Create log dir if needed # log shall be disabled during unit tests -# fix to be done in Logger -echo "Create dummy log file...." sudo mkdir -p /home/opnfv/functest/results/odl -sudo touch /home/opnfv/functest/results/functest.log sudo touch /home/opnfv/functest/results/odl/stdout.txt sudo chmod -Rf a+rw /home/opnfv -- cgit 1.2.3-korg