diff options
author | Timothy Edmund Crosley <timothy.crosley@gmail.com> | 2017-06-01 15:49:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-01 15:49:53 -0700 |
commit | b41338b33f5e5ca0ce587a81e2f8a54ddf920d8b (patch) | |
tree | dcef6ce6e26a87e1f755494001aaeb252c0c8aec | |
parent | 73b5adc97d665e31d3ef6146ed852ece11aea837 (diff) | |
parent | cd4339f564579cb50ef10d4c1f6512fa0ea56c89 (diff) | |
download | isort-b41338b33f5e5ca0ce587a81e2f8a54ddf920d8b.tar.gz |
Merge pull request #552 from alexwlchan/linting-in-travis
Add linting with flake8 in Travis
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | isort/pie_slice.py | 2 | ||||
-rw-r--r-- | test_isort.py | 11 | ||||
-rw-r--r-- | tox.ini | 8 |
4 files changed, 17 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index 6b23c0db..e79ee219 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ language: python matrix: include: - env: TOXENV=isort-check + - python: 3.6 + env: TOXENV=lint - python: 2.6 env: TOXENV=py26 - python: 2.7 diff --git a/isort/pie_slice.py b/isort/pie_slice.py index bfb341a7..2bff4682 100644 --- a/isort/pie_slice.py +++ b/isort/pie_slice.py @@ -451,6 +451,8 @@ if sys.version_info < (3, 2): from functools import wraps + _CacheInfo = collections.namedtuple("CacheInfo", "hits misses maxsize currsize") + def lru_cache(maxsize=100): """Least-recently-used cache decorator. Taking from: https://github.com/MiCHiLU/python-functools32/blob/master/functools32/functools32.py diff --git a/test_isort.py b/test_isort.py index 67eccc03..0aed1cd9 100644 --- a/test_isort.py +++ b/test_isort.py @@ -2024,6 +2024,7 @@ def test_import_line_mangles_issues_439(): """Test to ensure comment on import with parens doesn't cause issues""" test_input = ('import a # () import\n' 'from b import b\n') + assert SortImports(file_contents=test_input).output == test_input def test_alias_using_paren_issue_466(): @@ -2031,15 +2032,15 @@ def test_alias_using_paren_issue_466(): test_input = 'from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper\n' expected_output = ('from django.db.backends.mysql.base import (\n' ' DatabaseWrapper as MySQLDatabaseWrapper)\n') - assert SortImports(file_contents=test_input, line_length=50, use_parentheses=True).output == expected_output + assert SortImports(file_contents=test_input, line_length=50, use_parentheses=True).output == expected_output test_input = 'from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper\n' expected_output = ('from django.db.backends.mysql.base import (\n' ' DatabaseWrapper as MySQLDatabaseWrapper\n' ')\n') - assert SortImports(file_contents=test_input, line_length=50, multi_line_output=5, - use_parentheses=True).output == expected_output + assert SortImports(file_contents=test_input, line_length=50, multi_line_output=5, + use_parentheses=True).output == expected_output def test_strict_whitespace_by_default(capsys): @@ -2064,8 +2065,8 @@ def test_import_wraps_with_comment_issue_471(): ' -- long string of comments which wrap over') expected_output = ('from very_long_module_name import (\n' ' SuperLongClassName) # @UnusedImport -- long string of comments which wrap over\n') - assert SortImports(file_contents=test_input, line_length=50, multi_line_output=1, - use_parentheses=True).output == expected_output + assert SortImports(file_contents=test_input, line_length=50, multi_line_output=1, + use_parentheses=True).output == expected_output def test_import_case_produces_inconsistent_results_issue_472(): @@ -6,7 +6,8 @@ [tox] envlist = isort-check, - py26, py27, py33, py34, py35, py36, pypy + py26, py27, py33, py34, py35, py36, pypy, + lint [testenv] commands = @@ -20,3 +21,8 @@ commands = python setup.py isort deps = six + +[testenv:lint] +basepython = python2.7 +deps = flake8 +commands = flake8 isort setup.py test_isort.py |