Skip to content

Commit

Permalink
Merge 7381331 into b9e5339
Browse files Browse the repository at this point in the history
  • Loading branch information
pkolbus committed Jul 6, 2020
2 parents b9e5339 + 7381331 commit 828f064
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions run_tests.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from flake8.main import application
from flake8_isort import Flake8Isort
from tempfile import mkdtemp
from testfixtures import OutputCapture
Expand Down Expand Up @@ -47,7 +46,9 @@ def test_sorted_correctly_alpha(self):
'\n'
'import os\n',
)
self.write_isort_cfg('force_single_line=True\nforce_alphabetical_sort=True')
self.write_isort_cfg(
'force_single_line=True\nforce_alphabetical_sort=True'
)
with OutputCapture():
checker = Flake8Isort(None, file_path, lines)
ret = list(checker.run())
Expand Down Expand Up @@ -194,15 +195,19 @@ def test_force_single_line_imports(self):
'from plone.app.testing import applyProfile\n'
'from plone.app.testing import FunctionalTesting\n',
)
self.write_isort_cfg('force_alphabetical_sort=True\nforce_single_line=True')
self.write_isort_cfg(
'force_alphabetical_sort=True\nforce_single_line=True'
)
with OutputCapture():
checker = Flake8Isort(None, file_path, lines)
ret = list(checker.run())
self.assertEqual(ret, [])

def test_missing_add_imports(self):
(file_path, lines) = self.write_python_file('import os')
self.write_isort_cfg('add_imports=from __future__ import unicode_literals')
self.write_isort_cfg(
'add_imports=from __future__ import unicode_literals'
)
with OutputCapture():
checker = Flake8Isort(None, file_path, lines)
ret = list(checker.run())
Expand Down Expand Up @@ -230,7 +235,9 @@ def test_isortcfg_found(self):
self.assertTrue(ret[0][2].startswith('I001 '))

def test_isortcfg_not_found(self):
(file_path, lines) = self.write_python_file('from sys import pid, path')
(file_path, lines) = self.write_python_file(
'from sys import pid, path'
)
with OutputCapture():
checker = Flake8Isort(None, file_path, lines)
checker.search_current = False
Expand Down

0 comments on commit 828f064

Please sign in to comment.