aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-01-03 08:30:51 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2017-01-04 15:35:06 +0100
commit6d361c6804b85b870add58b5b4a6c7df8e9476d4 (patch)
treecdc995501542028ce406aaabb23560098d26d43f
parent563c3e610f184d311f8a4f45cbee51f532f73e49 (diff)
Patch logging.FileHandler
It avoids creating a dummy functest.log for unit testing. Change-Id: Ib163d5d58284822b1904444fb60b08e92ee0ab9b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/tests/unit/cli/commands/test_cli_env.py1
-rw-r--r--functest/tests/unit/core/test_testcase_base.py1
-rw-r--r--functest/tests/unit/odl/test_odl.py1
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py1
-rwxr-xr-xrun_unit_tests.sh3
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 4b6ea57a..f70761dc 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 b7c81d87..b6efa40d 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 d8c7f84e..4430c3b8 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 ce9086a7..c4b56660 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 e0e6195c..edce03c1 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