[virt-tools-list] [virt-manager] [PATCH 4/5] tests: Upgrade pep8 to pycodestyle

Cole Robinson crobinso at redhat.com
Wed Aug 2 17:30:08 UTC 2017


On 07/24/2017 10:03 AM, Cedric Bosdonnat wrote:
> On Mon, 2017-07-24 at 09:26 +0100, Radostin Stoyanov wrote:
>> The PEP8 [1] project has been renamed to pycodestyle [2].
>>
>> [1] https://github.com/codeclimate/pep8
>> [2] https://github.com/pycqa/pycodestyle
>> ---
>>  HACKING.md            |  2 +-
>>  setup.py              |  8 ++++----
>>  tests/pep8.cfg        | 15 ---------------
>>  tests/pycodestyle.cfg | 33 +++++++++++++++++++++++++++++++++
>>  4 files changed, 38 insertions(+), 20 deletions(-)
>>  delete mode 100644 tests/pep8.cfg
>>  create mode 100644 tests/pycodestyle.cfg
>>
>> diff --git a/HACKING.md b/HACKING.md
>> index a3780e0..f0e9cf5 100644
>> --- a/HACKING.md
>> +++ b/HACKING.md
>> @@ -7,7 +7,7 @@ python setup.py pylint    # Run a pylint script against the codebase
>>  ```
>>  
>>  Any patches shouldn't change the output of 'test' or 'pylint'. The
>> -'pylint' requires `pylint` and `python-pep8` to be installed.
>> +'pylint' requires `pylint` and `pycodestyle` to be installed.
>>  
>>  Our pylint script uses a blacklist rather than a whitelist approach,
>>  so it could throw some false positives or useless messages. If you think
>> diff --git a/setup.py b/setup.py
>> index 41b7a33..10bf932 100755
>> --- a/setup.py
>> +++ b/setup.py
>> @@ -566,7 +566,7 @@ class TestInitrdInject(TestBaseCommand):
>>  
>>  class CheckPylint(distutils.core.Command):
>>      user_options = []
>> -    description = "Check code using pylint and pep8"
>> +    description = "Check code using pylint and pycodestyle"
>>  
>>      def initialize_options(self):
>>          pass
>> @@ -582,9 +582,9 @@ class CheckPylint(distutils.core.Command):
>>          output_format = sys.stdout.isatty() and "colorized" or "text"
>>          exclude = ["virtinst/progress.py"]
>>  
>> -        print("running pep8")
>> -        cmd = "pep8 "
>> -        cmd += "--config tests/pep8.cfg "
>> +        print("running pycodestyle")
>> +        cmd = "pycodestyle "
>> +        cmd += "--config tests/pycodestyle.cfg "
>>          cmd += "--exclude %s " % ",".join(exclude)
>>          cmd += " ".join(files)
>>          os.system(cmd)
> 
> I guess completely dropping pep8 may not be good: who knows what distro
> doesn't have the pycodestyle package yet? I'ld rather use pep8 as a
> fallback if pycodestyle can't be found.

I think it's fine actually. Maintaining the pep8 path as well means carrying
two configs which is annoying. Even if distros don't package it yet it can be
easily installed with pip. Plus it's not strictly required for development and
doesn't fail intrusively if not present. So I've pushed this patch

Thanks,
Cole




More information about the virt-tools-list mailing list