hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.56k stars 288 forks source link

pycodestyle 2.10 breaks autopep8 tests #661

Closed bjornfor closed 1 year ago

bjornfor commented 1 year ago

Hi,

I'm a package maintainer of autopep8 in Nixpkgs, and since the upgrade of pycodestyle 2.9.1 -> 2.10, autopep8 fails to build like this:

$ cd nixpkgs
$ git checkout 3a2e1fcdd319f5bb4dce8b69abafc1fd0635079d
$ nix-build -A python3Packages.autopep8
[...]
============================= test session starts ==============================                                                                                                                                                              
platform linux -- Python 3.10.8, pytest-7.1.3, pluggy-1.0.0                                                                                                                                                                                   
rootdir: /build/autopep8-2.0.0                                                                                                                                                                                                                
collected 599 items / 1 deselected / 598 selected                                                                                                                                                                                             

test/test_autopep8.py .................................................. [  8%]                                                                                                                                                               
........................................................................ [ 20%]                                                                                                                                                               
........................................................................ [ 32%]                                                                                                                                                               
........................................................................ [ 44%]                                                                                                                                                               
........................................................................ [ 56%]                                                                                                                                                               
........................................................................ [ 68%]                                                                                                                                                               
..............FFFFFF.sF.FFFFFFFF...F.FFFF............................... [ 80%]                                                                                                                                                               
.........................................s.............................. [ 92%]                                                                                                                                                               
........s...................................                             [100%]                                                                                                                                                               

=================================== FAILURES ===================================                                                                                                                                                              
_____________________ SystemTests.test_w602_arg_is_string ______________________                                                                                                                                                              

self = <test.test_autopep8.SystemTests testMethod=test_w602_arg_is_string>                                                                                                                                                                    

    def test_w602_arg_is_string(self):                                                                                                                                                                                                        
        line = "raise ValueError, \"w602 test\"\n"                                                                                                                                                                                            
        fixed = "raise ValueError(\"w602 test\")\n"                                                                                                                                                                                           
        with autopep8_context(line, options=['--aggressive']) as result:                                                                                                                                                                      
>           self.assertEqual(fixed, result)                                                                                                                                                                                                   
E           AssertionError: 'raise ValueError("w602 test")\n' != 'raise ValueError, "w602 test"\n'                                                                                                                                            
E           - raise ValueError("w602 test")                                                                                                                                                                                                   
E           ?                 ^           -                                                                                                                                                                                                   
E           + raise ValueError, "w602 test"                                                                                                                                                                                                   
E           ?                 ^^                                                                                                                                                                                                              

test/test_autopep8.py:4940: AssertionError                                                                                                                                                                                                    
[...many similar looking failures...]

Changelog for pycodestyle: https://github.com/PyCQA/pycodestyle/blob/2.10.0/CHANGES.txt Nixpkgs issue: https://github.com/NixOS/nixpkgs/issues/205733

Your Environment

lilyinstarlight commented 1 year ago

@bjornfor, it looks like this was fixed by #659 but just hasn't made it into a release yet

bjornfor commented 1 year ago

@lilyinstarlight: thanks, closing then.

hhatto commented 1 year ago

Thanks for reporting.

We have released version 2.0.1, which fixes this problem.

sebastien-genete commented 1 year ago

Is it linked to this issue : https://github.com/hhatto/autopep8/issues/664 ?