[Kimchi-devel] [PATCH][Kimchi] Fix test_model pep8 non-compliant syntax

Daniel Henrique Barboza dhbarboza82 at gmail.com
Thu Aug 18 13:05:56 UTC 2016


What pep8 version are you using? I am using 1.6.2.

If your patch doesn't break the verification I do here while fixing
your case I am happy to apply it.

Also, please check other plug-ins because this kind of syntax exists
in Ginger/Gingerbase. I know because I wrote this myself and
I pretty sure I did it more than once.


Daniel

On 08/18/2016 02:36 AM, Ramon Medeiros wrote:
> /usr/bin/pep8 --filename '*.py,*.py.in' 
> --exclude="*config.py,*i18n.py,*tests/test_config.py" .
> ./tests/test_model.py:470:18: E126 continuation line over-indented for 
> hanging indent
> ./tests/test_model.py:491:18: E126 continuation line over-indented for 
> hanging indent
> ./tests/test_model.py:519:18: E126 continuation line over-indented for 
> hanging indent
>
>
> On 08/17/2016 06:43 PM, Daniel Henrique Barboza wrote:
>> Hmmm what pep8 rules does this specific code violates?
>>
>> On 08/17/2016 04:21 PM, Ramon Medeiros wrote:
>>> Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
>>> ---
>>>   tests/test_model.py | 29 ++++++++++-------------------
>>>   1 file changed, 10 insertions(+), 19 deletions(-)
>>>
>>> diff --git a/tests/test_model.py b/tests/test_model.py
>>> index 27225f8..09821b1 100644
>>> --- a/tests/test_model.py
>>> +++ b/tests/test_model.py
>>> @@ -466,12 +466,9 @@ class ModelTests(unittest.TestCase):
>>>           self.assertEqual(fw_manager.opened_ports, {})
>>>             mock_run_cmd.assert_has_calls(
>>> -            [
>>> -                 call(['firewall-cmd', '--state', '-q']),
>>> -                 call(['firewall-cmd', '--add-port=5905/tcp']),
>>> -                 call(['firewall-cmd', '--remove-port=5905/tcp'])
>>> -            ]
>>> -        )
>>> +            [call(['firewall-cmd', '--state', '-q']),
>>> +             call(['firewall-cmd', '--add-port=5905/tcp']),
>>> +             call(['firewall-cmd', '--remove-port=5905/tcp'])])
>>> @mock.patch('wok.plugins.kimchi.model.virtviewerfile.run_command')
>>>       def test_firewall_provider_ufw(self, mock_run_cmd):
>>> @@ -487,13 +484,10 @@ class ModelTests(unittest.TestCase):
>>>           self.assertEqual(fw_manager.opened_ports, {})
>>>             mock_run_cmd.assert_has_calls(
>>> -            [
>>> -                 call(['firewall-cmd', '--state', '-q']),
>>> -                 call(['ufw', 'status']),
>>> -                 call(['ufw', 'allow', '5905/tcp']),
>>> -                 call(['ufw', 'deny', '5905/tcp'])
>>> -            ]
>>> -        )
>>> +            [call(['firewall-cmd', '--state', '-q']),
>>> +             call(['ufw', 'status']),
>>> +             call(['ufw', 'allow', '5905/tcp']),
>>> +             call(['ufw', 'deny', '5905/tcp'])])
>>> @mock.patch('wok.plugins.kimchi.model.virtviewerfile.run_command')
>>>       def test_firewall_provider_iptables(self, mock_run_cmd):
>>> @@ -515,12 +509,9 @@ class ModelTests(unittest.TestCase):
>>>                           5905, '-j', 'ACCEPT']
>>>             mock_run_cmd.assert_has_calls(
>>> -            [
>>> -                 call(['firewall-cmd', '--state', '-q']),
>>> -                 call(['ufw', 'status']),
>>> -                 call(iptables_add), call(iptables_del)
>>> -            ]
>>> -        )
>>> +            [call(['firewall-cmd', '--state', '-q']),
>>> +             call(['ufw', 'status']),
>>> +             call(iptables_add), call(iptables_del)])
>>>         @unittest.skipUnless(utils.running_as_root(), 'Must be run 
>>> as root')
>>>       @mock.patch('wok.plugins.kimchi.model.virtviewerfile.'
>>
>> _______________________________________________
>> Kimchi-devel mailing list
>> Kimchi-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>
>




More information about the Kimchi-devel mailing list