Skip to content

Conversation

@generalov
Copy link
Contributor

No description provided.

@myint
Copy link
Owner

myint commented Dec 4, 2015

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?

@generalov
Copy link
Contributor Author

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.

@myint
Copy link
Owner

myint commented Dec 4, 2015

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.

@generalov
Copy link
Contributor Author

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.

autopep8 search the local configuration files in the filesystem by file path.
@myint
Copy link
Owner

myint commented Dec 5, 2015

Thanks!

myint added a commit that referenced this pull request Dec 5, 2015
Add test for "--no-config" option
@myint myint merged commit c180456 into myint:master Dec 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants