Skip to content

Commit

Permalink
Merge pull request #75 from sanjioh/pyproject-toml-support
Browse files Browse the repository at this point in the history
Add support for pyproject.toml.
  • Loading branch information
gforcada committed Dec 4, 2019
2 parents a00d4e5 + 53bc302 commit 9d6171a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
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

0 comments on commit 9d6171a

Please sign in to comment.