aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/odl/test_odl.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-01-03 10:38:53 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2017-01-04 15:35:38 +0100
commit1f59d1e080531d333fd0eb4fea0a4714c709da07 (patch)
tree239a7050df8711623db2752e26beb6ab515685c0 /functest/tests/unit/odl/test_odl.py
parent6d361c6804b85b870add58b5b4a6c7df8e9476d4 (diff)
Use mock_open() to prevent stdout.txt
/home/opnfv is no longer required. Change-Id: Iefb8faf3a7d548f3ae7d4076005d7b0bb93e63e1 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/odl/test_odl.py')
-rw-r--r--functest/tests/unit/odl/test_odl.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index 4430c3b8..8d184203 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -195,6 +195,8 @@ class ODLTesting(unittest.TestCase):
def test_main_robot_run_failed(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
+ mock.patch.object(odl, 'open', mock.mock_open(),
+ create=True), \
self.assertRaises(RobotError):
self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, *args)
@@ -203,6 +205,8 @@ class ODLTesting(unittest.TestCase):
def test_main_parse_results_failed(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
+ mock.patch.object(odl, 'open', mock.mock_open(),
+ create=True), \
mock.patch.object(self.test, 'parse_results',
side_effect=RobotError):
self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, *args)
@@ -223,6 +227,8 @@ class ODLTesting(unittest.TestCase):
def test_main(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
+ mock.patch.object(odl, 'open', mock.mock_open(),
+ create=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
@@ -232,6 +238,8 @@ class ODLTesting(unittest.TestCase):
def test_main_makedirs_oserror17(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
+ mock.patch.object(odl, 'open', mock.mock_open(),
+ create=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
@@ -241,6 +249,8 @@ class ODLTesting(unittest.TestCase):
def test_main_testcases_in_failure(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
+ mock.patch.object(odl, 'open', mock.mock_open(),
+ create=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
@@ -250,6 +260,8 @@ class ODLTesting(unittest.TestCase):
def test_main_remove_oserror(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
+ mock.patch.object(odl, 'open', mock.mock_open(),
+ create=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)