aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/tests/unit/core/test_behaveframework.py
diff options
context:
space:
mode:
authorVincent Danno <vincent.danno@orange.com>2021-05-26 13:08:55 +0200
committerVincent Danno <vincent.danno@orange.com>2021-06-01 20:40:32 +0200
commita656fd764b0a608caaf198bfa9685a09a7eaca16 (patch)
tree501fa47e06658b8a43e2ccca4837c530a49dfc72 /xtesting/tests/unit/core/test_behaveframework.py
parent6192b2cf9ffd46bdb8189ce3236cf4d9b722b69c (diff)
Drop six
python 2 was dropped [1] so we don't need six anymore [1]: https://gerrit.opnfv.org/gerrit/c/functest-xtesting/+/68262 Signed-off-by: Vincent Danno <vincent.danno@orange.com> Change-Id: I840211990b76f77a46e9e737fc4a4c857b57c0b2
Diffstat (limited to 'xtesting/tests/unit/core/test_behaveframework.py')
-rw-r--r--xtesting/tests/unit/core/test_behaveframework.py27
1 files changed, 11 insertions, 16 deletions
diff --git a/xtesting/tests/unit/core/test_behaveframework.py b/xtesting/tests/unit/core/test_behaveframework.py
index 754813ab..72fa6f29 100644
--- a/xtesting/tests/unit/core/test_behaveframework.py
+++ b/xtesting/tests/unit/core/test_behaveframework.py
@@ -14,7 +14,6 @@ import os
import unittest
import mock
-import six
from xtesting.core import behaveframework
@@ -32,26 +31,26 @@ class ParseResultTesting(unittest.TestCase):
self.test = behaveframework.BehaveFramework(
case_name='behave', project_name='xtesting')
- @mock.patch('six.moves.builtins.open', side_effect=OSError)
+ @mock.patch('builtins.open', side_effect=OSError)
def test_raises_exc_open(self, *args): # pylint: disable=unused-argument
with self.assertRaises(OSError):
self.test.parse_results()
@mock.patch('json.load', return_value=[{'foo': 'bar'}])
- @mock.patch('six.moves.builtins.open', mock.mock_open())
+ @mock.patch('builtins.open', mock.mock_open())
def test_raises_exc_key(self, *args): # pylint: disable=unused-argument
with self.assertRaises(KeyError):
self.test.parse_results()
@mock.patch('json.load', return_value=[])
- @mock.patch('six.moves.builtins.open', mock.mock_open())
+ @mock.patch('builtins.open', mock.mock_open())
def test_raises_exe_zerodivision(self, *args):
# pylint: disable=unused-argument
with self.assertRaises(ZeroDivisionError):
self.test.parse_results()
def _test_result(self, response, result):
- with mock.patch('six.moves.builtins.open', mock.mock_open()), \
+ with mock.patch('builtins.open', mock.mock_open()), \
mock.patch('json.load', return_value=response):
self.test.parse_results()
self.assertEqual(self.test.result, result)
@@ -68,7 +67,7 @@ class ParseResultTesting(unittest.TestCase):
data = [{'status': 'passed'}, {'status': 'passed'}]
self._test_result(data, 100)
- @mock.patch('six.moves.builtins.open', mock.mock_open())
+ @mock.patch('builtins.open', mock.mock_open())
def test_count(self, *args): # pylint: disable=unused-argument
self._response.extend([{'status': 'failed'}, {'status': 'skipped'}])
with mock.patch('json.load', mock.Mock(return_value=self._response)):
@@ -121,11 +120,9 @@ class RunTesting(unittest.TestCase):
args_list = [
'--tags=', '--junit',
'--junit-directory={}'.format(self.test.res_dir),
- '--format=json', '--outfile={}'.format(self.test.json_file)]
- if six.PY3:
- args_list += [
- '--format=behave_html_formatter:HTMLFormatter',
- '--outfile={}'.format(html_file)]
+ '--format=json', '--outfile={}'.format(self.test.json_file),
+ '--format=behave_html_formatter:HTMLFormatter',
+ '--outfile={}'.format(html_file)]
args_list.append('foo')
args[0].assert_called_once_with(args_list)
mock_method.assert_called_once_with()
@@ -155,11 +152,9 @@ class RunTesting(unittest.TestCase):
args_list = [
'--tags=', '--junit',
'--junit-directory={}'.format(self.test.res_dir),
- '--format=json', '--outfile={}'.format(self.test.json_file)]
- if six.PY3:
- args_list += [
- '--format=behave_html_formatter:HTMLFormatter',
- '--outfile={}'.format(html_file)]
+ '--format=json', '--outfile={}'.format(self.test.json_file),
+ '--format=behave_html_formatter:HTMLFormatter',
+ '--outfile={}'.format(html_file)]
if console:
args_list += ['--format=pretty', '--outfile=-']
args_list.append('foo')