dovetail tool: bugfix CI job dovetail-merge-master fail 51/26451/1
authorxudan <xudan16@huawei.com>
Fri, 23 Dec 2016 01:53:31 +0000 (01:53 +0000)
committerxudan <xudan16@huawei.com>
Fri, 23 Dec 2016 01:53:31 +0000 (01:53 +0000)
JIRA: DOVETAIL-156

Change-Id: I3453571568494850049eb7956387ee7e275934af
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/tests/unit/test_parser.py

index 5fb4dbb..7047d5c 100644 (file)
@@ -15,11 +15,13 @@ import logging
 import os
 import unittest
 import yaml
+import mock
 
 from dovetail import parser
 from dovetail.utils.dovetail_config import DovetailConfig as dt_cfg
 
 
+@mock.patch('dovetail.parser.Parser.logger')
 class TestParser(unittest.TestCase):
 
     test_path = os.path.dirname(os.path.realpath(__file__))
@@ -27,10 +29,9 @@ class TestParser(unittest.TestCase):
     def setUp(self):
         """Test case setup"""
         dt_cfg.load_config_files()
-        parser.Parser.create_log()
         logging.disable(logging.CRITICAL)
 
-    def test_parser_cmd(self):
+    def test_parser_cmd(self, mock_logger):
         """Test whether the command is correctly parsed."""
         mock_cmd = "python /functest/ci/run_tests.py "\
                    "-t {{validate_testcase}} -r"
@@ -44,7 +45,7 @@ class TestParser(unittest.TestCase):
                            "tempest_smoke_serial -r")
         self.assertEqual(expected_output, output)
 
-    def test_parser_cmd_fail(self):
+    def test_parser_cmd_fail(self, mock_logger):
         """Test whether the command is correctly parsed."""
         mock_cmd = "python /functest/ci/run_tests.py "\
                    "-t {{validate_testcase}} -r"