From 5dd0d0ffd46e7665fddde8fd2f4da1a9b58506bb Mon Sep 17 00:00:00 2001 From: Deepak Chandella Date: Fri, 5 Jul 2019 22:31:36 +0530 Subject: Adding first patch for behave feature Change-Id: Ic975c301103b49cdec2bd26746b708388f21e892 Signed-off-by: Deepak Chandella --- xtesting/tests/unit/core/test_robotframework.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xtesting/tests/unit/core/test_robotframework.py') diff --git a/xtesting/tests/unit/core/test_robotframework.py b/xtesting/tests/unit/core/test_robotframework.py index 398cf87a..19c4e0f0 100644 --- a/xtesting/tests/unit/core/test_robotframework.py +++ b/xtesting/tests/unit/core/test_robotframework.py @@ -9,7 +9,6 @@ """Define the classes required to fully cover robot.""" -import errno import logging import os import unittest @@ -194,14 +193,11 @@ class RunTesting(unittest.TestCase): mmethod.asser_not_called() @mock.patch('os.makedirs', side_effect=Exception) + @mock.patch('os.path.exists', return_value=False) def test_makedirs_exc(self, *args): self._test_makedirs_exc() args[0].assert_called_once_with(self.test.res_dir) - - @mock.patch('os.makedirs', side_effect=OSError) - def test_makedirs_oserror(self, *args): - self._test_makedirs_exc() - args[0].assert_called_once_with(self.test.res_dir) + args[1].assert_called_once_with(self.test.res_dir) @mock.patch('robot.run') def _test_makedirs(self, *args): @@ -218,15 +214,19 @@ class RunTesting(unittest.TestCase): mock_method.assert_called_once_with() mmethod.assert_called_once_with() - @mock.patch('os.makedirs', side_effect=OSError(errno.EEXIST, '')) + @mock.patch('os.makedirs') + @mock.patch('os.path.exists', return_value=True) def test_makedirs_oserror17(self, *args): self._test_makedirs() args[0].assert_called_once_with(self.test.res_dir) + args[1].assert_not_called() @mock.patch('os.makedirs') + @mock.patch('os.path.exists', return_value=False) def test_makedirs(self, *args): self._test_makedirs() args[0].assert_called_once_with(self.test.res_dir) + args[1].assert_called_once_with(self.test.res_dir) @mock.patch('os.makedirs') @mock.patch('robot.run') -- cgit 1.2.3-korg