Closed generalov closed 8 years ago
Because the autopep8
searches a configuration file in the current directory. Usually the current directory is the projects root directory with setup.py. I don't want write the temporary configuration file to the current directory of the test process because this could be anyware and can theoretically contain 'setup.cfg'.
I think the directory changing may cause a throuble only when tests are run in parallel threads of the single process. If tests are run in parallel in the different processes (with pytest-xdist for example) it isn't an issue beause each process has its own current directory.
Correct me if I am wrong, but doesn't autopep8 search for the parent directories of the Python file (rather than the current working directory)? So,
$ autopep8 foo/bar/something.py
would check foo/bar
for a configuration file?
https://github.com/hhatto/autopep8/blob/master/autopep8.py#L3221
I don't actually use this feature myself so I don't remember the exact details.
You are right. autopep8 can search configuration file by filename too. I've added a code in pyformat.py to make it work. I've remove the change_cwd from from test.
Thanks!
I would prefer not changing directories. I think this may fail if the tests are run in parallel. Is there any reason for changing directories?