diff options
author | Kien Nguyen <kiennt@vn.fujitsu.com> | 2017-10-25 08:29:48 +0700 |
---|---|---|
committer | Kien Nguyen <kiennt@vn.fujitsu.com> | 2017-10-25 09:16:49 +0700 |
commit | cc7179c9185a18f135c1f4f20f8880252f53b02f (patch) | |
tree | 503ec59b84c367c4c338463b0f3a8ad5db861e9e | |
parent | fe734d00da2dcf6476ed6df7843736c7aa2eee43 (diff) | |
download | cliff-cc7179c9185a18f135c1f4f20f8880252f53b02f.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
-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 |