Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pyproject.toml. #75

Merged
merged 1 commit into from Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions run_tests.py
Expand Up @@ -293,3 +293,24 @@ def test_isort_formatted_output(self):
self.assertEqual(ret[0][0], 2)
self.assertEqual(ret[0][1], 0)
self.assertIn(diff, ret[0][2])

def test_isort_uses_pyproject_toml_if_available(self):
(file_path, lines) = self._given_a_file_in_test_dir(
'import os\n'
'from sys import path\n',
isort_config=''
)

pyproject_toml_path = os.path.join(
os.path.dirname(file_path), 'pyproject.toml',
)
with open(pyproject_toml_path, 'w') as f:
f.write('[tool.isort]\nlines_between_types=1')

with OutputCapture():
checker = Flake8Isort(None, file_path, lines)
ret = list(checker.run())
self.assertEqual(len(ret), 1)
self.assertEqual(ret[0][0], 2)
self.assertEqual(ret[0][1], 0)
self.assertTrue(ret[0][2].startswith('I003 '))
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -46,7 +46,7 @@
zip_safe=False,
install_requires=[
'flake8 >= 3.2.1',
'isort >= 4.3.0',
'isort[pyproject] >= 4.3.0',
'testfixtures',
],
extras_require={
Expand Down