summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-09 20:46:41 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-09 20:50:45 +0100
commit6432b7db47fe05f8b5b4c55d658537bf71a881c6 (patch)
treeca754e63b42555a82bbf5cd66eea727dd4ca99fe
parenta62ed36ae05c7ca64c3d4aba2702820e268fc8f1 (diff)
Ensure logging is disabled when unit testing feature
Change-Id: Ibe08477a8b50a6c9b71ab4e5b0ebaaab36692b08 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/tests/unit/core/test_feature.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py
index 8c73bb5d5..3219c7265 100644
--- a/functest/tests/unit/core/test_feature.py
+++ b/functest/tests/unit/core/test_feature.py
@@ -55,6 +55,9 @@ class FeatureTestingBase(unittest.TestCase):
class FeatureTesting(FeatureTestingBase):
def setUp(self):
+ # logging must be disabled else it calls time.time()
+ # what will break these unit tests.
+ logging.disable(logging.CRITICAL)
with mock.patch('six.moves.builtins.open'):
self.feature = feature.Feature(
project_name=self._project_name, case_name=self._case_name)
@@ -74,6 +77,9 @@ class FeatureTesting(FeatureTestingBase):
class BashFeatureTesting(FeatureTestingBase):
def setUp(self):
+ # logging must be disabled else it calls time.time()
+ # what will break these unit tests.
+ logging.disable(logging.CRITICAL)
with mock.patch('six.moves.builtins.open'):
self.feature = feature.BashFeature(
project_name=self._project_name, case_name=self._case_name)
@@ -108,7 +114,4 @@ class BashFeatureTesting(FeatureTestingBase):
if __name__ == "__main__":
- # logging must be disabled else it calls time.time()
- # what will break these unit tests.
- logging.disable(logging.CRITICAL)
unittest.main(verbosity=2)