Hello community,

here is the log from the commit of package python-flake8-isort for 
openSUSE:Factory checked in at 2020-08-12 10:31:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flake8-isort (Old)
 and      /work/SRC/openSUSE:Factory/.python-flake8-isort.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flake8-isort"

Wed Aug 12 10:31:18 2020 rev:2 rq:825739 version:4.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flake8-isort/python-flake8-isort.changes  
2020-04-11 23:47:29.739132584 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-flake8-isort.new.3399/python-flake8-isort.changes
        2020-08-12 10:36:50.632301582 +0200
@@ -1,0 +2,17 @@
+Tue Aug 11 08:16:08 UTC 2020 - Benjamin Greiner <[email protected]>
+
+- Update to version 4.0.0
+  * support isort >= 5 [bnavigator, pkolbus]
+
+-------------------------------------------------------------------
+Mon Jul 13 16:53:36 UTC 2020 - Benjamin Greiner <[email protected]>
+
+- Update to version 3.0.1
+  * Work around FailedToLoadPlugin exception by requiring isort 4.x. 
+    Likewise, pin the major version of all dependencies, to reduce 
+    risk of any future incompatibilities. [pkolbus] 
+- Update to version 3.0.0
+  * Let isort search the configuration, rather than flake8-isort
+    try to find it. [jnns]  
+
+-------------------------------------------------------------------

Old:
----
  flake8-isort-2.9.1.tar.gz

New:
----
  flake8-isort-4.0.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-flake8-isort.spec ++++++
--- /var/tmp/diff_new_pack.VkslGU/_old  2020-08-12 10:36:51.420301973 +0200
+++ /var/tmp/diff_new_pack.VkslGU/_new  2020-08-12 10:36:51.420301973 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-flake8-isort
-Version:        2.9.1
+Version:        4.0.0
 Release:        0
 Summary:        Plugin integrating isort in flake8
 License:        GPL-2.0-only
@@ -30,6 +30,7 @@
 BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  %{python_module testfixtures}
+BuildRequires:  %{python_module toml}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-flake8 >= 3.2.1
@@ -52,12 +53,13 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-# the three skipped tests need to have the extension registered in the flake8 
-> same sitelib
-%pytest run_tests.py -k 'not (test_config_file or test_default_option or 
test_isort_uses_pyproject)'
+%pytest 
 
 %files %{python_files}
 %doc README.rst CHANGES.rst
 %license LICENSE*
-%{python_sitelib}/*
+%{python_sitelib}/flake8_isort.py*
+%pycache_only %{python_sitelib}/__pycache__/flake8_isort*
+%{python_sitelib}/flake8_isort-%{version}-py*.egg-info
 
 %changelog

++++++ flake8-isort-2.9.1.tar.gz -> flake8-isort-4.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/CHANGES.rst 
new/flake8-isort-4.0.0/CHANGES.rst
--- old/flake8-isort-2.9.1/CHANGES.rst  2020-03-28 23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/CHANGES.rst  2020-08-11 10:04:15.000000000 +0200
@@ -3,6 +3,33 @@
 Changelog
 =========
 
+4.0.0 (2020-08-11)
+------------------
+
+- Nothing changed yet.
+
+
+4.0.0a0 (2020-08-07)
+--------------------
+
+- support isort >= 5 [bnavigator, pkolbus]
+
+
+3.0.1 (2020-07-08)
+------------------
+
+- Work around `FailedToLoadPlugin` exception by requiring `isort` 4.x. 
Likewise,
+  pin the major version of all dependencies, to reduce risk of any future
+  incompatibilities.
+  [pkolbus]
+
+
+3.0.0 (2020-04-15)
+------------------
+
+- Let `isort` search the configuration, rather than `flake8-isort` try to find 
it.
+  [jnns]
+
 2.9.1 (2020-03-28)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/PKG-INFO 
new/flake8-isort-4.0.0/PKG-INFO
--- old/flake8-isort-2.9.1/PKG-INFO     2020-03-28 23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/PKG-INFO     2020-08-11 10:04:15.741300300 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flake8-isort
-Version: 2.9.1
+Version: 4.0.0
 Summary: flake8 plugin that integrates isort .
 Home-page: https://github.com/gforcada/flake8-isort
 Author: Gil Forcada
@@ -27,27 +27,11 @@
         Install with pip::
         
             $ pip install flake8-isort
-            
+        
         Install with conda::
         
             $ conda install -c conda-forge flake8-isort
         
-        Options
-        -------
-        Config options can be set in several different locations:
-        
-        * ``.isort.cfg``
-        * ``.editorconfig``
-        * an ``[isort]`` section in ``setup.cfg``, ``tox.ini``, or ``.flake8``
-        
-        This potentially avoids to lint a project that has no formal 
definition of how import should be sorted.
-        
-        With either ``--no-isort-config`` command line switch,
-        or ``no-isort-config`` flake8 configuration option it can be disabled.
-        
-        Since version 2.6 we introduce new ``--isort-show-traceback`` option.
-        It is used to show verbose multi-line output from ``isort``.
-        By default it is turned off.
         
         Configuration
         -------------
@@ -95,6 +79,33 @@
         Changelog
         =========
         
+        4.0.0 (2020-08-11)
+        ------------------
+        
+        - Nothing changed yet.
+        
+        
+        4.0.0a0 (2020-08-07)
+        --------------------
+        
+        - support isort >= 5 [bnavigator, pkolbus]
+        
+        
+        3.0.1 (2020-07-08)
+        ------------------
+        
+        - Work around `FailedToLoadPlugin` exception by requiring `isort` 4.x. 
Likewise,
+          pin the major version of all dependencies, to reduce risk of any 
future
+          incompatibilities.
+          [pkolbus]
+        
+        
+        3.0.0 (2020-04-15)
+        ------------------
+        
+        - Let `isort` search the configuration, rather than `flake8-isort` try 
to find it.
+          [jnns]
+        
         2.9.1 (2020-03-28)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/README.rst 
new/flake8-isort-4.0.0/README.rst
--- old/flake8-isort-2.9.1/README.rst   2020-03-28 23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/README.rst   2020-08-11 10:04:15.000000000 +0200
@@ -19,27 +19,11 @@
 Install with pip::
 
     $ pip install flake8-isort
-    
+
 Install with conda::
 
     $ conda install -c conda-forge flake8-isort
 
-Options
--------
-Config options can be set in several different locations:
-
-* ``.isort.cfg``
-* ``.editorconfig``
-* an ``[isort]`` section in ``setup.cfg``, ``tox.ini``, or ``.flake8``
-
-This potentially avoids to lint a project that has no formal definition of how 
import should be sorted.
-
-With either ``--no-isort-config`` command line switch,
-or ``no-isort-config`` flake8 configuration option it can be disabled.
-
-Since version 2.6 we introduce new ``--isort-show-traceback`` option.
-It is used to show verbose multi-line output from ``isort``.
-By default it is turned off.
 
 Configuration
 -------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/flake8_isort.egg-info/PKG-INFO 
new/flake8-isort-4.0.0/flake8_isort.egg-info/PKG-INFO
--- old/flake8-isort-2.9.1/flake8_isort.egg-info/PKG-INFO       2020-03-28 
23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/flake8_isort.egg-info/PKG-INFO       2020-08-11 
10:04:15.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flake8-isort
-Version: 2.9.1
+Version: 4.0.0
 Summary: flake8 plugin that integrates isort .
 Home-page: https://github.com/gforcada/flake8-isort
 Author: Gil Forcada
@@ -27,27 +27,11 @@
         Install with pip::
         
             $ pip install flake8-isort
-            
+        
         Install with conda::
         
             $ conda install -c conda-forge flake8-isort
         
-        Options
-        -------
-        Config options can be set in several different locations:
-        
-        * ``.isort.cfg``
-        * ``.editorconfig``
-        * an ``[isort]`` section in ``setup.cfg``, ``tox.ini``, or ``.flake8``
-        
-        This potentially avoids to lint a project that has no formal 
definition of how import should be sorted.
-        
-        With either ``--no-isort-config`` command line switch,
-        or ``no-isort-config`` flake8 configuration option it can be disabled.
-        
-        Since version 2.6 we introduce new ``--isort-show-traceback`` option.
-        It is used to show verbose multi-line output from ``isort``.
-        By default it is turned off.
         
         Configuration
         -------------
@@ -95,6 +79,33 @@
         Changelog
         =========
         
+        4.0.0 (2020-08-11)
+        ------------------
+        
+        - Nothing changed yet.
+        
+        
+        4.0.0a0 (2020-08-07)
+        --------------------
+        
+        - support isort >= 5 [bnavigator, pkolbus]
+        
+        
+        3.0.1 (2020-07-08)
+        ------------------
+        
+        - Work around `FailedToLoadPlugin` exception by requiring `isort` 4.x. 
Likewise,
+          pin the major version of all dependencies, to reduce risk of any 
future
+          incompatibilities.
+          [pkolbus]
+        
+        
+        3.0.0 (2020-04-15)
+        ------------------
+        
+        - Let `isort` search the configuration, rather than `flake8-isort` try 
to find it.
+          [jnns]
+        
         2.9.1 (2020-03-28)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/flake8_isort.egg-info/SOURCES.txt 
new/flake8-isort-4.0.0/flake8_isort.egg-info/SOURCES.txt
--- old/flake8-isort-2.9.1/flake8_isort.egg-info/SOURCES.txt    2020-03-28 
23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/flake8_isort.egg-info/SOURCES.txt    2020-08-11 
10:04:15.000000000 +0200
@@ -4,9 +4,9 @@
 MANIFEST.in
 README.rst
 flake8_isort.py
-run_tests.py
 setup.cfg
 setup.py
+test_flake8_isort.py
 flake8_isort.egg-info/PKG-INFO
 flake8_isort.egg-info/SOURCES.txt
 flake8_isort.egg-info/dependency_links.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/flake8-isort-2.9.1/flake8_isort.egg-info/requires.txt 
new/flake8-isort-4.0.0/flake8_isort.egg-info/requires.txt
--- old/flake8-isort-2.9.1/flake8_isort.egg-info/requires.txt   2020-03-28 
23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/flake8_isort.egg-info/requires.txt   2020-08-11 
10:04:15.000000000 +0200
@@ -1,6 +1,7 @@
-flake8>=3.2.1
-isort[pyproject]>=4.3.5
-testfixtures
+flake8<4,>=3.2.1
+isort<6,>=4.3.5
+testfixtures<7,>=6.8.0
 
 [test]
-pytest
+pytest<6,>=4.0.2
+toml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/flake8_isort.py 
new/flake8-isort-4.0.0/flake8_isort.py
--- old/flake8-isort-2.9.1/flake8_isort.py      2020-03-28 23:00:35.000000000 
+0100
+++ new/flake8-isort-4.0.0/flake8_isort.py      2020-08-11 10:04:15.000000000 
+0200
@@ -1,22 +1,23 @@
 # -*- coding: utf-8 -*-
-from difflib import Differ
-from isort import SortImports
-from os.path import expanduser
-from testfixtures import OutputCapture
 
-import os
+import isort
 
 
-try:
-    from configparser import ConfigParser as SafeConfigParser
-except ImportError:
-    from ConfigParser import SafeConfigParser
+if hasattr(isort, 'api'):  # isort 5
+    from contextlib import redirect_stdout
+    from difflib import unified_diff
+    from io import StringIO
+    from pathlib import Path
 
+    import warnings
+else:
+    from difflib import Differ
+    from testfixtures import OutputCapture
 
-__version__ = '2.9.1'
+__version__ = '4.0.0'
 
 
-class Flake8Isort(object):
+class Flake8IsortBase(object):
     name = 'flake8_isort'
     version = __version__
     isort_unsorted = (
@@ -35,7 +36,6 @@
         'I005 isort found an unexpected missing import'
     )
 
-    config_file = None
     show_traceback = False
     stdin_display_name = None
     search_current = True
@@ -46,12 +46,6 @@
 
     @classmethod
     def add_options(cls, parser):
-        parser.add_option(
-            '--no-isort-config',
-            action='store_true',
-            parse_from_config=True,
-            help='Do not require explicit configuration to be found'
-        )
 
         parser.add_option(
             '--isort-show-traceback',
@@ -62,93 +56,31 @@
 
     @classmethod
     def parse_options(cls, options):
-        if options.no_isort_config is None:
-            cls.config_file = True
-        else:
-            cls.config_file = False
-
         cls.stdin_display_name = options.stdin_display_name
         cls.show_traceback = options.isort_show_traceback
 
-    def run(self):
-        settings_file = self.search_isort_config()
-        if self.config_file and not settings_file:
-            yield 0, 0, self.no_config_msg, type(self)
-        else:
-            if self.filename is not self.stdin_display_name:
-                file_path = self.filename
-            else:
-                file_path = None
-            with OutputCapture() as buffer:
-                sort_result = SortImports(
-                    file_path=file_path,
-                    file_contents=''.join(self.lines),
-                    check=True,
-                    settings_path=settings_file,
-                    show_diff=True,
-                )
-            traceback = self._format_isort_output(buffer)
 
-            for line_num, message in self.sortimports_linenum_msg(sort_result):
-                if self.show_traceback:
-                    message += traceback
-                yield line_num, 0, message, type(self)
-
-    def search_isort_config(self):
-        # type: () -> Optional[str]  # noqa: F821
-        """Search for isort configuration all the way up to the root folder
-
-        Looks for ``.isort.cfg``, ``.editorconfig`` or ``[isort]`` section in
-        ``setup.cfg``, ``tox.ini``, or ``.flake8`` config files.
-        """
-        full_path = os.path.abspath(self.filename)
-        split_path = (os.path.dirname(full_path), True)
-        while split_path[1]:
-            config_on_file = self._search_config_on_path(split_path[0])
-            if config_on_file:
-                return config_on_file
-            split_path = os.path.split(split_path[0])
-
-        if self.search_current:
-            return self.search_isort_config_at_current()
-
-        # last attempt, check home folder
-        home = expanduser('~')
-        config_on_home = self._search_config_on_path(home)
-        if config_on_home:
-            return config_on_home
-
-        return None
-
-    def search_isort_config_at_current(self):
-        # type: () -> Optional[str]  # noqa: F821
-        """Search for isort configuration at current directory"""
-        return self._search_config_on_path(os.path.realpath('.'))
-
-    def _search_config_on_path(self, path):
-        # type: (str) -> Optional[str]  # noqa: F821
-        """Search for isort configuration files at the specifed path.
-
-        Args:
-            path: The path to search for config files on.
-
-        Return:
-            str: the isort config if found otherwise, None
-        """
-        for config_file in ('.isort.cfg', '.editorconfig'):
-            config_file_path = os.path.join(path, config_file)
-            if os.path.isfile(config_file_path):
-                return config_file_path
-
-        # Check for '[isort]' section in other configuration files.
-        for config_file in ('tox.ini', 'setup.cfg', '.flake8'):
-            config_file_path = os.path.join(path, config_file)
-            config = SafeConfigParser()
-            config.read(config_file_path)
-            if 'isort' in config.sections():
-                return config_file_path
+class Flake8Isort4(Flake8IsortBase):
+    """class for isort <5"""
 
-        return None
+    def run(self):
+        if self.filename is not self.stdin_display_name:
+            file_path = self.filename
+        else:
+            file_path = None
+        with OutputCapture() as buffer:
+            sort_result = isort.SortImports(
+                file_path=file_path,
+                file_contents=''.join(self.lines),
+                check=True,
+                show_diff=True,
+            )
+        traceback = self._format_isort_output(buffer)
+
+        for line_num, message in self.sortimports_linenum_msg(sort_result):
+            if self.show_traceback:
+                message += traceback
+            yield line_num, 0, message, type(self)
 
     def sortimports_linenum_msg(self, sort_result):
         """Parses isort.SortImports for line number changes and message
@@ -250,3 +182,91 @@
                 for new_idx, new_line in enumerate(
                         sort_imports.out_lines.pop(idx).splitlines()):
                     sort_imports.out_lines.insert(idx + new_idx, new_line)
+
+
+class Flake8Isort5(Flake8IsortBase):
+    """class for isort >=5"""
+
+    def run(self):
+        if self.filename is not self.stdin_display_name:
+            file_path = Path(self.filename)
+            isort_config = isort.settings.Config(
+                settings_path=file_path.parent)
+        else:
+            file_path = None
+            isort_config = isort.settings.Config(
+                settings_path=Path.cwd())
+        input_string = ''.join(self.lines)
+        traceback = ''
+        isort_changed = False
+        input_stream = StringIO(input_string)
+        output_stream = StringIO()
+        isort_stdout = StringIO()
+        try:
+            with redirect_stdout(isort_stdout):
+                isort_changed = isort.api.sort_stream(
+                    input_stream=input_stream,
+                    output_stream=output_stream,
+                    config=isort_config,
+                    file_path=file_path)
+        except isort.exceptions.FileSkipped:
+            pass
+        except isort.exceptions.ISortError as e:
+            warnings.warn(e)
+        if isort_changed:
+            outlines = output_stream.getvalue()
+            diff_delta = "".join(unified_diff(
+                              input_string.splitlines(keepends=True),
+                              outlines.splitlines(keepends=True),
+                              fromfile="{}:before".format(self.filename),
+                              tofile="{}:after".format(self.filename)))
+            traceback = (isort_stdout.getvalue() + "\n" + diff_delta)
+            for line_num, message in self.isort_linenum_msg(diff_delta):
+                if self.show_traceback:
+                    message += traceback
+                yield line_num, 0, message, type(self)
+
+    def isort_linenum_msg(self, udiff):
+        """Parse unified diff for changes and generate messages
+
+        Args
+        ----
+        udiff : unified diff delta
+
+        Yields
+        ------
+        tuple: A tuple of the specific isort line number and message.
+        """
+        line_num = 0
+        additions = []
+        moves = []
+        for line in udiff.splitlines():
+            if line.startswith('@@', 0, 2):
+                line_num = int(line[4:].split(' ')[0].split(',')[0])
+                continue
+            elif not line_num:  # skip lines before first hunk
+                continue
+            if line.startswith(' ', 0, 1):
+                line_num += 1  # Ignore unchanged lines but increment line_num.
+            elif line.startswith('-', 0, 1):
+                if line.strip() == '-':
+                    yield line_num, self.isort_blank_unexp
+                    line_num += 1
+                else:
+                    moves.append(line[1:])
+                    yield line_num, self.isort_unsorted
+                    line_num += 1
+            elif line.startswith('+', 0, 1):
+                if line.strip() == '+':
+                    # Include newline additions but do not increment line_num.
+                    yield line_num, self.isort_blank_req
+                else:
+                    additions.append((line_num, line))
+
+        # return all additions that did not move
+        for line_num, line in additions:
+            if not line[1:] in moves:
+                yield line_num, self.isort_add_unexp
+
+
+Flake8Isort = Flake8Isort5 if hasattr(isort, 'api') else Flake8Isort4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/run_tests.py 
new/flake8-isort-4.0.0/run_tests.py
--- old/flake8-isort-2.9.1/run_tests.py 2020-03-28 23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/run_tests.py 1970-01-01 01:00:00.000000000 +0100
@@ -1,317 +0,0 @@
-# -*- coding: utf-8 -*-
-from flake8.main import application
-from flake8_isort import Flake8Isort
-from tempfile import mkdtemp
-from testfixtures import OutputCapture
-
-import collections
-import os
-import unittest
-
-
-class TestFlake8Isort(unittest.TestCase):
-
-    def _given_a_file_in_test_dir(self, contents, isort_config):
-        test_dir = os.path.realpath(mkdtemp())
-        file_path = os.path.join(test_dir, 'test.py')
-        isort_path = os.path.join(test_dir, '.isort.cfg')
-        with open(file_path, 'w') as a_file:
-            a_file.write(contents)
-
-        with open(isort_path, 'w') as a_file:
-            a_file.write('[settings]\n')
-            a_file.write(isort_config)
-
-        return (file_path, contents)
-
-    def test_sorted_correctly_alpha(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from sys import path\n'
-            '\n'
-            'import os\n',
-            isort_config='force_single_line=True\nforce_alphabetical_sort=True'
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(ret, [])
-
-    def test_sorted_correctly_default(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'import os\n'
-            'from sys import path\n',
-            isort_config=''
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(ret, [])
-
-    def test_with_eof_blank_lines(self):
-        """Pass with eof blank line as flake8 will flag them"""
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'import os\n'
-            'from sys import path\n'
-            '\n'
-            '\n'
-            '   \n',
-            isort_config=''
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(ret, [])
-
-    def test_imports_requires_blank_line(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from __future__ import division\n'
-            'import threading\n'
-            'from sys import pid\n',
-            isort_config=''
-        )
-        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 '))
-
-    def test_isortcfg_skip_file(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'skipped_file',
-            isort_config='skip=test.py'
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(ret, [])
-
-    def test_file_skipped_with_comment(self):
-        # Note: files skipped in this way are not marked as
-        # "skipped" by isort <= 4.2.15, so we handle them in a
-        # different code path and test to ensure they also work.
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            '# isort:skip_file',
-            isort_config=''
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(ret, [])
-
-    def test_imports_unexpected_blank_line(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from __future__ import division\n'
-            '\n'
-            'import threading\n'
-            '\n'
-            'from sys import pid\n',
-            isort_config=''
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(len(ret), 1)
-            self.assertEqual(ret[0][0], 4)
-            self.assertEqual(ret[0][1], 0)
-            self.assertTrue(ret[0][2].startswith('I004 '))
-
-    def test_sorted_incorrectly_multiple(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from __future__ import division\n'
-            'import os\n'
-            'from sys import pid\n'
-            'import threading\n'
-            '\n'
-            'import isort\n'
-            '\n\n\n'
-            'def func()\n',
-            isort_config=''
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(len(ret), 3)
-            self.assertEqual(ret[0][0], 2)
-            self.assertEqual(ret[0][1], 0)
-            self.assertTrue(ret[0][2].startswith('I003 '))
-            self.assertEqual(ret[1][0], 4)
-            self.assertEqual(ret[1][1], 0)
-            self.assertTrue(ret[1][2].startswith('I001 '))
-            self.assertEqual(ret[2][0], 9)
-            self.assertEqual(ret[2][1], 0)
-            self.assertTrue(ret[2][2].startswith('I004 '))
-
-    def test_sorted_incorrectly(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from sys import pid\n'
-            'import threading',
-            isort_config='force_single_line=True'
-        )
-        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('I001 '))
-
-    def test_empty_file(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            '\n\n',
-            isort_config=''
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(ret, [])
-
-    def test_wrapped_imports(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from deluge.common import (fdate, fpcnt, fpeer, fsize, fspeed,\n'
-            '                           ftime, get_path_size, is_infohash,\n'
-            '                           is_ip, is_magnet, is_url)\n',
-            isort_config='wrap_length=65'
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(ret, [])
-
-    def test_force_single_line_imports(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from plone.app.testing import applyProfile\n'
-            'from plone.app.testing import FunctionalTesting\n',
-            isort_config='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._given_a_file_in_test_dir(
-            'import os',
-            isort_config='add_imports=from __future__ import unicode_literals'
-        )
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            ret = list(checker.run())
-            self.assertEqual(len(ret), 2)
-            self.assertEqual(ret[0][0], 1)
-            self.assertEqual(ret[0][1], 0)
-            self.assertTrue(ret[0][2].startswith('I005 '))
-            self.assertEqual(ret[1][0], 1)
-            self.assertEqual(ret[1][1], 0)
-            self.assertTrue(ret[1][2].startswith('I003 '))
-
-    def test_isortcfg_found(self):
-        # _given_a_file_in_test_dir already creates an .isort.cfg file
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from sys import pid\n'
-            'import threading',
-            isort_config='force_single_line=True'
-        )
-
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            checker.config_file = True
-            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('I001 '))
-
-    def test_isortcfg_not_found(self):
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from sys import pid\n'
-            'import threading',
-            isort_config='force_single_line=True'
-        )
-        # remove the .isort.cfg file
-        isortcfg_path = file_path.split('/')[: -1]
-        isortcfg_path = '{0}/.isort.cfg'.format('/'.join(isortcfg_path))
-        os.remove(isortcfg_path)
-
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            checker.search_current = False
-            checker.config_file = True
-            ret = list(checker.run())
-            self.assertEqual(len(ret), 1)
-            self.assertEqual(ret[0][0], 0)
-            self.assertEqual(ret[0][1], 0)
-            self.assertTrue(ret[0][2].startswith('I002 '))
-
-    def test_default_option(self):
-        """By default a config file (.isort.cfg) is expected"""
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from sys import pid\n'
-            'import threading\n',
-            isort_config='force_single_line=True'
-        )
-        with OutputCapture():
-            app = application.Application()
-            app.run([file_path, ])
-            self.assertTrue(Flake8Isort.config_file)
-
-    def test_config_file(self):
-        """Check that one can force to not look for a config file"""
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from sys import pid\n'
-            'import threading\n',
-            isort_config='force_single_line=True'
-        )
-        with OutputCapture():
-            app = application.Application()
-            app.run(['--no-isort-config', file_path, ])
-            self.assertFalse(Flake8Isort.config_file)
-
-    def test_isort_formatted_output(self):
-        options = collections.namedtuple(
-            'Options', [
-                'no_isort_config',
-                'isort_show_traceback',
-                'stdin_display_name'
-            ]
-        )
-
-        (file_path, lines) = self._given_a_file_in_test_dir(
-            'from __future__ import division\n'
-            'import os\n'
-            'from sys import pid\n',
-            isort_config=''
-        )
-
-        diff = ' from __future__ import division\n+\n import os'
-
-        with OutputCapture():
-            checker = Flake8Isort(None, file_path, lines)
-            checker.parse_options(options(None, True, 'stdin'))
-            ret = list(checker.run())
-            self.assertEqual(len(ret), 1)
-            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 '))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/setup.py 
new/flake8-isort-4.0.0/setup.py
--- old/flake8-isort-2.9.1/setup.py     2020-03-28 23:00:35.000000000 +0100
+++ new/flake8-isort-4.0.0/setup.py     2020-08-11 10:04:15.000000000 +0200
@@ -56,13 +56,14 @@
     test_suite='run_tests',
     zip_safe=False,
     install_requires=[
-        'flake8 >= 3.2.1',
-        'isort[pyproject] >= 4.3.5',
-        'testfixtures',
+        'flake8 >= 3.2.1, <4',
+        'isort >= 4.3.5, <6',
+        'testfixtures >= 6.8.0, <7',
     ],
     extras_require={
         'test': [
-            'pytest',
+            'pytest >= 4.0.2, <6',
+            'toml',
         ],
     },
     entry_points={
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flake8-isort-2.9.1/test_flake8_isort.py 
new/flake8-isort-4.0.0/test_flake8_isort.py
--- old/flake8-isort-2.9.1/test_flake8_isort.py 1970-01-01 01:00:00.000000000 
+0100
+++ new/flake8-isort-4.0.0/test_flake8_isort.py 2020-08-11 10:04:15.000000000 
+0200
@@ -0,0 +1,216 @@
+"""unit tests for flake8-isort
+
+the test should pass with both isort 4 and isort 5
+"""
+
+import collections
+import os
+import pytest
+
+from flake8_isort import Flake8Isort
+
+
+def write_python_file(tmpdir, content):
+    file_path = os.path.join(str(tmpdir), 'test.py')
+    with open(file_path, 'w') as python_file:
+        python_file.write(content)
+    return (file_path, content)
+
+
+def write_isort_cfg(tmpdir, content):
+    content = '[settings]\n' + content
+    write_config_file(tmpdir, '.isort.cfg', content)
+
+
+def write_setup_cfg(tmpdir, content):
+    content = '[isort]\n' + content
+    write_config_file(tmpdir, 'setup.cfg', content)
+
+
+def write_tox_ini(tmpdir, content):
+    content = '[isort]\n' + content
+    write_config_file(tmpdir, 'tox.ini', content)
+
+
+def write_pyproject_toml(tmpdir, content):
+    content = '[tool.isort]\n' + content
+    write_config_file(tmpdir, 'pyproject.toml', content)
+
+
+def write_config_file(tmpdir, filename, content):
+    file_path = os.path.join(str(tmpdir), filename)
+    with open(file_path, 'w') as config_file:
+        config_file.write(content)
+
+
+def check_isort_ret(ret, ref):
+    """Sort the return by (line, errortype) and compare it to the reference"""
+    assert len(ret) == len(ref)
+    for ret_i, ref_i in zip(sorted(ret, key=lambda x: (x[0], x[2])), ref):
+        assert ret_i[:2] == ref_i[:2]
+        assert ret_i[2].startswith(ref_i[2])
+
+
+testcases = [
+    {'name': 'sorted_correctly_default',
+     'code': ('import os\n'
+              'from sys import path\n'),
+     'ref': []},
+    {'name': 'sorted_correctly_alpha',
+     'config': 'force_single_line=True\n'
+               'force_alphabetical_sort=True\n',
+     'code': 'from sys import path\n'
+             '\n'
+             'import os\n',
+     'ref': []},
+    {'name': 'eof_blank_lines',
+     'code': 'import os\n'
+             'from sys import path\n'
+             '\n'
+             '\n'
+             '   \n',
+     'ref': []},
+    {'name': 'imports_requires_blank_line',
+     'code': 'from __future__ import division\n'
+             'import threading\n'
+             'from sys import pid\n',
+     'ref': [(2, 0, 'I003 ')]},
+    {'name': 'isortcfg_skip_file',
+     'config': 'skip=test.py',
+     'code': 'skipped_file',
+     'ref': []},
+    {'name': 'file_skipped_with_comment',
+     'code': '# isort:skip_file',
+     'ref': []},
+    {'name': 'imports_unexpected_blank_line',
+     'code': 'from __future__ import division\n'
+             '\n'
+             'import threading\n'
+             '\n'
+             'from sys import pid\n',
+     'ref': [(4, 0, 'I004 ')]},
+    {'name': 'sorted_incorrectly_multiple',
+     'code': 'from __future__ import division\n'
+             'import os\n'
+             'from sys import pid\n'
+             'import threading\n'
+             '\n'
+             'import isort\n'
+             '\n\n\n'
+             'def func()\n',
+     'ref': [(2, 0, 'I003 '),
+             (4, 0, 'I001 '),
+             (9, 0, 'I004 ')]},
+    {'name': 'sorted_incorrectly',
+     'config': 'force_single_line=True',
+     'code': 'from sys import pid\n'
+             'import threading',
+     'ref': [(2, 0, 'I001 ')]},
+    {'name': 'empty_file',
+     'code': '\n\n',
+     'ref': []},
+    {'name': 'wrapped_imports',
+     'config': 'wrap_length=65',
+     'code': 'from deluge.common import (fdate, fpcnt, fpeer, fsize, fspeed,\n'
+             '                           ftime, get_path_size, is_infohash,\n'
+             '                           is_ip, is_magnet, is_url)\n',
+     'ref': []},
+    {'name': 'force_single_line_imports',
+     'config': 'force_alphabetical_sort=True\n'
+               'force_single_line=True',
+     'code': 'from plone.app.testing import applyProfile\n'
+             'from plone.app.testing import FunctionalTesting\n',
+     'ref': []},
+    {'name': 'missing_add_imports',
+     'config': 'add_imports=from __future__ import unicode_literals',
+     'code': 'import os\n',
+     'ref': [(1, 0, 'I003'),
+             (1, 0, 'I005')]},
+]
+
+
[email protected]('mode', ["file", "code_string"])
[email protected]('testcase', testcases,
+                         ids=[t['name'] for t in testcases])
+def test_flake8_isort(tmpdir, testcase, mode):
+    """Test the code examples in files and directly from string"""
+    with tmpdir.as_cwd():
+        if 'config' in testcase:
+            write_isort_cfg(tmpdir, testcase['config'])
+        if mode == "file":
+            (file_path, lines) = write_python_file(tmpdir, testcase['code'])
+            checker = Flake8Isort(None, file_path, lines)
+        elif mode == "code_string":
+            checker = Flake8Isort(None, None, testcase['code'])
+        else:
+            raise RuntimeError("invalid mode")
+        ret = list(checker.run())
+        check_isort_ret(ret, testcase['ref'])
+
+
+def test_isortcfg_found(tmpdir):
+    (file_path, lines) = write_python_file(
+        tmpdir,
+        'from sys import pid\n'
+        'import threading',
+    )
+    write_isort_cfg(tmpdir, 'force_single_line=True')
+    checker = Flake8Isort(None, file_path, lines)
+    checker.config_file = True
+    ret = list(checker.run())
+    check_isort_ret(ret, [(2, 0, 'I001 ')])
+
+
+def test_isortcfg_not_found(tmpdir):
+    (file_path, lines) = write_python_file(
+        tmpdir,
+        'from sys import pid, path'
+    )
+    checker = Flake8Isort(None, file_path, lines)
+    checker.search_current = False
+    checker.config_file = True
+    ret = list(checker.run())
+    check_isort_ret(ret, [(1, 0, 'I001 ')])
+
+
+def test_isort_formatted_output(tmpdir):
+    options = collections.namedtuple(
+        'Options', [
+            'no_isort_config',
+            'isort_show_traceback',
+            'stdin_display_name'
+        ]
+    )
+
+    (file_path, lines) = write_python_file(
+        tmpdir,
+        'from __future__ import division\n'
+        'import os\n'
+        'from sys import pid\n',
+    )
+
+    diff = ' from __future__ import division\n+\n import os'
+
+    checker = Flake8Isort(None, file_path, lines)
+    checker.parse_options(options(None, True, 'stdin'))
+    ret = list(checker.run())
+    assert len(ret) == 1
+    assert ret[0][0] == 2
+    assert ret[0][1] == 0
+    assert diff in ret[0][2]
+
+
[email protected](
+    'method_to_write_config',
+    [write_isort_cfg, write_setup_cfg, write_tox_ini, write_pyproject_toml])
+def test_if_config_file_is_used(tmpdir, method_to_write_config):
+    (file_path, lines) = write_python_file(
+        tmpdir,
+        'import os\n'
+        'from sys import path\n',
+    )
+    method_to_write_config(tmpdir, 'lines_between_types=1')
+
+    checker = Flake8Isort(None, file_path, lines)
+    ret = list(checker.run())
+    check_isort_ret(ret, [(2, 0, 'I003 ')])


Reply via email to