summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2017-06-02 08:57:53 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2017-06-02 08:57:53 -0700
commit0aca83884667f1b20605e3bbef48bacf4f8b77fa (patch)
tree3d53621457cb11e45ea698ed2fe538fae666ac5c
parent8b2a9d563b235c7389c7a188e13f13a45ba2777c (diff)
parentb41338b33f5e5ca0ce587a81e2f8a54ddf920d8b (diff)
downloadisort-0aca83884667f1b20605e3bbef48bacf4f8b77fa.tar.gz
Merge branch 'develop' of https://github.com/timothycrosley/isort into develop
-rw-r--r--.travis.yml2
-rw-r--r--isort/pie_slice.py2
-rw-r--r--test_isort.py11
-rw-r--r--tox.ini8
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():
diff --git a/tox.ini b/tox.ini
index 1ee185be..97473031 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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