diff options
author | Kien Nguyen <kiennt@vn.fujitsu.com> | 2017-10-25 08:29:48 +0700 |
---|---|---|
committer | Julie Pichon <jpichon@redhat.com> | 2017-12-06 13:53:11 +0000 |
commit | 5a5c0101bc401ac0b63b97204e0b5f2c2b9f59f0 (patch) | |
tree | 761f8b27bac65845d8e9c870c49a87f5d00b7416 | |
parent | 09aa2058c8c2eeb9724e37199225a26b07a85d29 (diff) | |
download | cliff-5a5c0101bc401ac0b63b97204e0b5f2c2b9f59f0.tar.gz |
Fix PEP8 in gate
Zuul openstack-tox-pep8 failed due to several errors [1]
- Use bare except.
- Use ambiguous variable name 'l'. As pycodestyle doc [2] mentioned,
'Never use the characters 'l', 'O', or 'I' as variable names.'.
[1] http://logs.openstack.org/96/477396/3/gate/openstack-tox-pep8/f851c2d/ara/result/57b145af-a103-4982-9e9c-7c93c21b32df/
[2] https://pep8.readthedocs.io/en/latest/_modules/pycodestyle.html
Change-Id: Iefdf10245a64e58fa6b5d8174a09fb90f18c81a8
(cherry picked from commit cc7179c9185a18f135c1f4f20f8880252f53b02f)
-rw-r--r-- | cliff/tests/test_formatters_table.py | 26 | ||||
-rw-r--r-- | cliff/tests/test_help.py | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/cliff/tests/test_formatters_table.py b/cliff/tests/test_formatters_table.py index d536cac..7627359 100644 --- a/cliff/tests/test_formatters_table.py +++ b/cliff/tests/test_formatters_table.py @@ -390,46 +390,46 @@ class TestListFormatter(base.TestBase): @mock.patch('cliff.utils.terminal_width') def test_max_width_80(self, tw): # no resize - l = tw.return_value = 80 + width = tw.return_value = 80 self.assertEqual( - self._expected_mv[l], + self._expected_mv[width], _table_tester_helper(self._col_names, self._col_data), ) @mock.patch('cliff.utils.terminal_width') def test_max_width_50(self, tw): # resize 1 column - l = tw.return_value = 50 + width = tw.return_value = 50 actual = _table_tester_helper(self._col_names, self._col_data, extra_args=['--fit-width']) - self.assertEqual(self._expected_mv[l], actual) - self.assertEqual(l, len(actual.splitlines()[0])) + self.assertEqual(self._expected_mv[width], actual) + self.assertEqual(width, len(actual.splitlines()[0])) @mock.patch('cliff.utils.terminal_width') def test_max_width_45(self, tw): # resize 2 columns - l = tw.return_value = 45 + width = tw.return_value = 45 actual = _table_tester_helper(self._col_names, self._col_data, extra_args=['--fit-width']) - self.assertEqual(self._expected_mv[l], actual) - self.assertEqual(l, len(actual.splitlines()[0])) + self.assertEqual(self._expected_mv[width], actual) + self.assertEqual(width, len(actual.splitlines()[0])) @mock.patch('cliff.utils.terminal_width') def test_max_width_40(self, tw): # resize all columns - l = tw.return_value = 40 + width = tw.return_value = 40 actual = _table_tester_helper(self._col_names, self._col_data, extra_args=['--fit-width']) - self.assertEqual(self._expected_mv[l], actual) - self.assertEqual(l, len(actual.splitlines()[0])) + self.assertEqual(self._expected_mv[width], actual) + self.assertEqual(width, len(actual.splitlines()[0])) @mock.patch('cliff.utils.terminal_width') def test_max_width_10(self, tw): # resize all columns limited by min_width=8 - l = tw.return_value = 10 + width = tw.return_value = 10 actual = _table_tester_helper(self._col_names, self._col_data, extra_args=['--fit-width']) - self.assertEqual(self._expected_mv[l], actual) + self.assertEqual(self._expected_mv[width], actual) # 3 columns each 8 wide, plus table spacing and borders expected_width = 11 * 3 + 1 self.assertEqual(expected_width, len(actual.splitlines()[0])) diff --git a/cliff/tests/test_help.py b/cliff/tests/test_help.py index 8b66fbe..b727a16 100644 --- a/cliff/tests/test_help.py +++ b/cliff/tests/test_help.py @@ -12,7 +12,7 @@ try: from StringIO import StringIO -except: +except ImportError: from io import StringIO import os import sys |