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.57k stars 290 forks source link

`SystemTests.test_e101_skip_innocuous` test fails with tarball from pypi because of missing tox.ini #645

Closed paper42 closed 2 years ago

paper42 commented 2 years ago

The tarball from pypi doesn't contain tox.ini, but one test expects it and fails when it doesn't find it.

%: pytest
...
=================================== FAILURES ===================================                                                              
_____________________ SystemTests.test_e101_skip_innocuous _____________________

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

        def test_e101_skip_innocuous(self):                                                                                                       
            # pep8 will complain about this even if the tab indentation found   
            # elsewhere is in a multiline string. If we don't filter the innocuous                                                                
            # report properly, the below command will take a long time.                                                                           
            p = Popen(list(AUTOPEP8_CMD_TUPLE) +                         
                      ['-vvv', '--select=E101', '--diff',                                                                                         
                       '--global-config={}'.format(os.devnull),        
                       os.path.join(ROOT_DIR, 'test', 'e101_example.py')],                        
                      stdout=PIPE, stderr=PIPE)                                                                                                   
            output = [x.decode('utf-8') for x in p.communicate()][0]     
            setup_cfg_file = os.path.join(ROOT_DIR, "setup.cfg")                                                                                  
            tox_ini_file = os.path.join(ROOT_DIR, "tox.ini")      
            expected = """\                                                                                                                       
    read config path: /dev/null                                                                                                                   
    read config path: {}                                                                                                                          
    read config path: {}                                                 
    """.format(setup_cfg_file, tox_ini_file)
>           self.assertEqual(expected, output)
E           AssertionError: 'read[69 chars]etup.cfg\nread config path: /builddir/autopep8-1.7.0/tox.ini\n' != 'read[69 chars]etup.cfg\n'
E             read config path: /dev/null
E             read config path: /builddir/autopep8-1.7.0/setup.cfg
E           - read config path: /builddir/autopep8-1.7.0/tox.ini

test/test_autopep8.py:1058: AssertionError

Your Environment