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

Daniel Henrique Barboza dhbarboza82 at gmail.com
Thu Aug 18 14:35:41 UTC 2016



On 08/18/2016 11:20 AM, Ramon Medeiros wrote:
> I'm ok with this message.
>
> I'm happy that did not broke newer versions

Yeah this is a happy patch

>
> On 08/18/2016 10:51 AM, Daniel Henrique Barboza wrote:
>>
>>
>> On 08/18/2016 10:33 AM, Ramon Medeiros wrote:
>>> I'm using 1.5.7 and this syntax is breaking make check-local. Is 
>>> yours working fine?
>>>
>>> I just sent this patch to let make check-local runs straight
>>
>> Mine works fine:
>>
>>
>> contrib/check_i18n.py ./i18n.py
>> Checking for invalid i18n string...
>> Checking for invalid i18n string successfully
>> /bin/pep8 --version
>> 1.6.2
>> /bin/pep8 --filename '*.py,*.py.in' 
>> --exclude="*config.py,*i18n.py,*tests/test_config.py" .
>> ./check_ui_code_errors.sh
>> UI errors codes are correct
>> Whitespace verification ...
>> Ok
>> IBM copyright year verification ...
>> [danielhb at arthas kimchi]$
>>
>> I've tested with your patch and my check-local is still functional so 
>> I am
>> going to accept it. However I've amended the commit-msg:
>>
>>
>> Author: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
>> Date:   Wed Aug 17 16:21:17 2016 -0300
>>
>>     test/test_model.py pep8 1.5.7 fix
>>
>>     This patch fixes the syntax of test_model.py to be compliant
>>     with pep8 version 1.5.7.
>>
>>     Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
>>
>>
>> Let me know if this is OK to you.
>>
>>>
>>> On 08/18/2016 10:05 AM, Daniel Henrique Barboza wrote:
>>>> 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