diff options
author | 2021-11-09 11:22:02 +0100 | |
---|---|---|
committer | 2021-11-09 13:21:47 +0100 | |
commit | 17739d718901a10f7ec0aaf9a6d53141294a347d (patch) | |
tree | a98e6d09a42016ceec90713adac681918a4a9c62 /xtesting/tests/unit/core/test_unit.py | |
parent | 92681911699428a87ea56c0263832b96a93da3da (diff) |
Leverage latest pylint features
It adds encoding in all open call and leverage f-strings.
Change-Id: I70ccd2bfcadae44929d5874f98fa3bf4ff644488
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/tests/unit/core/test_unit.py')
-rw-r--r-- | xtesting/tests/unit/core/test_unit.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xtesting/tests/unit/core/test_unit.py b/xtesting/tests/unit/core/test_unit.py index 9e5f1321..5cce83be 100644 --- a/xtesting/tests/unit/core/test_unit.py +++ b/xtesting/tests/unit/core/test_unit.py @@ -54,7 +54,7 @@ class SuiteTesting(unittest.TestCase): ['subunit2junitxml'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) mock_open.assert_called_once_with( - '{}/results.xml'.format(self.psrunner.res_dir), 'w') + f'{self.psrunner.res_dir}/results.xml', 'w', encoding='utf-8') @mock.patch('subprocess.Popen') def test_generate_xunit_ok(self, *args): @@ -69,7 +69,7 @@ class SuiteTesting(unittest.TestCase): ['subunit2junitxml'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) mock_open.assert_called_once_with( - '{}/results.xml'.format(self.psrunner.res_dir), 'w') + f'{self.psrunner.res_dir}/results.xml', 'w', encoding='utf-8') @mock.patch('subprocess.check_output', side_effect=Exception) def test_generate_html_ko(self, *args): @@ -78,7 +78,7 @@ class SuiteTesting(unittest.TestCase): self.psrunner.generate_html(stream) args[0].assert_called_once_with( ['subunit2html', stream, - '{}/results.html'.format(self.psrunner.res_dir)]) + f'{self.psrunner.res_dir}/results.html']) @mock.patch('subprocess.check_output') def test_generate_html_ok(self, *args): @@ -86,7 +86,7 @@ class SuiteTesting(unittest.TestCase): self.psrunner.generate_html(stream) args[0].assert_called_once_with( ['subunit2html', stream, - '{}/results.html'.format(self.psrunner.res_dir)]) + f'{self.psrunner.res_dir}/results.html']) @mock.patch('xtesting.core.unit.Suite.generate_html') @mock.patch('xtesting.core.unit.Suite.generate_xunit') @@ -98,14 +98,14 @@ class SuiteTesting(unittest.TestCase): with mock.patch('builtins.open', mock.mock_open()) as m_open: self.assertEqual(self.psrunner.run(), status) m_open.assert_called_once_with( - '{}/subunit_stream'.format(self.psrunner.res_dir), 'wb') + f'{self.psrunner.res_dir}/subunit_stream', 'wb') self.assertEqual(self.psrunner.is_successful(), result) args[0].assert_called_once_with(self.psrunner.suite) args[1].assert_not_called() args[2].assert_called_once_with(mock.ANY) args[3].assert_called_once_with(mock.ANY) args[4].assert_called_once_with( - '{}/subunit_stream'.format(self.psrunner.res_dir)) + f'{self.psrunner.res_dir}/subunit_stream') @mock.patch('xtesting.core.unit.Suite.generate_html') @mock.patch('xtesting.core.unit.Suite.generate_xunit') @@ -117,14 +117,14 @@ class SuiteTesting(unittest.TestCase): with mock.patch('builtins.open', mock.mock_open()) as m_open: self.assertEqual(self.psrunner.run(name=name), status) m_open.assert_called_once_with( - '{}/subunit_stream'.format(self.psrunner.res_dir), 'wb') + f'{self.psrunner.res_dir}/subunit_stream', 'wb') self.assertEqual(self.psrunner.is_successful(), result) args[0].assert_called_once_with(self.psrunner.suite) args[1].assert_called_once_with() args[2].assert_called_once_with(mock.ANY) args[3].assert_called_once_with(mock.ANY) args[4].assert_called_once_with( - '{}/subunit_stream'.format(self.psrunner.res_dir)) + f'{self.psrunner.res_dir}/subunit_stream') @mock.patch('xtesting.core.unit.Suite.generate_html') @mock.patch('xtesting.core.unit.Suite.generate_xunit') |