Hello community,

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

Package is "python-isort"

Tue Aug 25 12:38:08 2020 rev:17 rq:827700 version:5.4.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-isort/python-isort.changes        
2020-08-13 10:12:59.274597261 +0200
+++ /work/SRC/openSUSE:Factory/.python-isort.new.3399/python-isort.changes      
2020-08-25 12:38:11.421407943 +0200
@@ -1,0 +2,12 @@
+Wed Aug 19 04:17:27 UTC 2020 - Steve Kowalik <[email protected]>
+
+- Update to 5.4.2:
+  * Fixed #1383: Known other does not work anymore with .editorconfig.
+  * Fixed: Regression in first known party path expansion.
+  * Fixed #1381: --combine-as loses # noqa in different circumstances.
+  * Implemented #1373: support for length sort only of direct (AKA
+    straight) imports.
+  * Fixed #1321: --combine-as loses # noqa.
+  * Fixed #1375: --dont-order-by-type CLI broken. 
+
+-------------------------------------------------------------------

Old:
----
  isort-5.3.2-gh.tar.gz
  isort-5.3.2.tar.gz

New:
----
  isort-5.4.2-gh.tar.gz
  isort-5.4.2.tar.gz

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

Other differences:
------------------
++++++ python-isort.spec ++++++
--- /var/tmp/diff_new_pack.bZdte3/_old  2020-08-25 12:38:12.045408060 +0200
+++ /var/tmp/diff_new_pack.bZdte3/_new  2020-08-25 12:38:12.049408061 +0200
@@ -27,7 +27,7 @@
 %endif
 %define skip_python2 1
 Name:           python-isort%{psuffix}
-Version:        5.3.2
+Version:        5.4.2
 Release:        0
 Summary:        A Python utility / library to sort Python imports
 License:        MIT

++++++ isort-5.3.2-gh.tar.gz -> isort-5.4.2-gh.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/.pre-commit-config.yaml 
new/isort-5.4.2/.pre-commit-config.yaml
--- old/isort-5.3.2/.pre-commit-config.yaml     1970-01-01 01:00:00.000000000 
+0100
+++ new/isort-5.4.2/.pre-commit-config.yaml     2020-08-15 05:12:38.000000000 
+0200
@@ -0,0 +1,5 @@
+repos:
+  - repo: https://github.com/timothycrosley/isort
+    rev: 5.3.0
+    hooks:
+      - id: isort
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/CHANGELOG.md new/isort-5.4.2/CHANGELOG.md
--- old/isort-5.3.2/CHANGELOG.md        2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/CHANGELOG.md        2020-08-15 05:12:38.000000000 +0200
@@ -3,6 +3,18 @@
 
 NOTE: isort follows the [semver](https://semver.org/) versioning standard.
 
+### 5.4.2 Aug 14, 2020
+  - Fixed #1383: Known other does not work anymore with .editorconfig.
+  - Fixed: Regression in first known party path expansion.
+
+### 5.4.1 [Hotfix] Aug 13, 2020
+  - Fixed #1381: --combine-as loses # noqa in different circumstances.
+
+### 5.4.0 Aug 12, 2020
+  - Implemented #1373: support for length sort only of direct (AKA straight) 
imports.
+  - Fixed #1321: --combine-as loses # noqa.
+  - Fixed #1375: --dont-order-by-type CLI broken.
+
 ### 5.3.2 [Hotfix] Aug 7, 2020
   - Fixed incorrect warning code (W503->W0503).
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/README.md new/isort-5.4.2/README.md
--- old/isort-5.3.2/README.md   2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/README.md   2020-08-15 05:12:38.000000000 +0200
@@ -251,6 +251,40 @@
 ...
 ```
 
+**8 - Vertical Hanging Indent Bracket**
+
+Same as Mode 3 - _Vertical Hanging Indent_ but the closing parentheses
+on the last line is indented.
+
+```python
+from third_party import (
+    lib1,
+    lib2,
+    lib3,
+    lib4,
+    )
+```
+
+**9 - Vertical Prefix From Module Import**
+
+Starts a new line with the same `from MODULE import ` prefix when lines are 
longer than the line length limit.
+
+```python
+from third_party import lib1, lib2, lib3
+from third_party import lib4, lib5, lib6
+```
+
+**10 - Hanging Indent With Parentheses**
+
+Same as Mode 2 - _Hanging Indent_ but uses parentheses instead of backslash
+for wrapping long lines.
+
+```python
+from third_party import (
+    lib1, lib2, lib3,
+    lib4, lib5, lib6)
+```
+
 Note: to change the how constant indents appear - simply change the
 indent property with the following accepted formats:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/docs/configuration/options.md 
new/isort-5.4.2/docs/configuration/options.md
--- old/isort-5.3.2/docs/configuration/options.md       2020-08-07 
10:21:51.000000000 +0200
+++ new/isort-5.4.2/docs/configuration/options.md       2020-08-15 
05:12:38.000000000 +0200
@@ -56,7 +56,7 @@
 
 ## Skip Gitignore
 
-Treat project as a git respository and ignore files listed in .gitignore
+Treat project as a git repository and ignore files listed in .gitignore
 
 **Type:** Bool  
 **Default:** `False`  
@@ -225,7 +225,7 @@
 
 ## Multi Line Output
 
-Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 
5-vert-grid-grouped, 6-vert-grid-grouped-no-comma).
+Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 
5-vert-grid-grouped, 6-vert-grid-grouped-no-comma, 7-noqa, 
8-vertical-hanging-indent-bracket, 9-vertical-prefix-from-module-import, 
10-hanging-indent-with-parentheses).
 
 **Type:** Wrapmodes  
 **Default:** `WrapModes.GRID`  
@@ -293,6 +293,19 @@
 - --ls
 - --length-sort
 
+## Length Sort Straight Imports
+
+Sort straight imports by their string length. Similar to `length_sort` but 
applies only to
+straight imports and doesn't affect from imports.
+
+**Type:** Bool
+**Default:** `False`
+**Python & Config File Name:** length_sort_straight
+**CLI Flags:**
+
+- --lss
+- --length-sort-straight
+
 ## Length Sort Sections
 
 **No Description**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/docs/upgrade_guides/5.0.0.md 
new/isort-5.4.2/docs/upgrade_guides/5.0.0.md
--- old/isort-5.3.2/docs/upgrade_guides/5.0.0.md        2020-08-07 
10:21:51.000000000 +0200
+++ new/isort-5.4.2/docs/upgrade_guides/5.0.0.md        2020-08-15 
05:12:38.000000000 +0200
@@ -78,7 +78,7 @@
 
 ```
   - repo: https://github.com/timothycrosley/isort
-    rev: master
+    rev: 5.3.2
     hooks:
       - id: isort
 ```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/docs/warning_and_error_codes/W0500.md 
new/isort-5.4.2/docs/warning_and_error_codes/W0500.md
--- old/isort-5.3.2/docs/warning_and_error_codes/W0500.md       1970-01-01 
01:00:00.000000000 +0100
+++ new/isort-5.4.2/docs/warning_and_error_codes/W0500.md       2020-08-15 
05:12:38.000000000 +0200
@@ -0,0 +1,22 @@
+# W0500 Warning Codes
+
+The W0500 error codes are reserved for warnings related to a major release of 
the isort project.
+Generally, the existence of any of these will trigger one additional warning 
listing the upgrade guide.
+
+For the most recent upgrade guide, see: [The 5.0.0 Upgrade 
Guide.](https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/).
+
+## W0501: Deprecated CLI flags were included that will be ignored.
+
+This warning will be shown if a CLI flag is passed into the isort command that 
is no longer supported but can safely be ignored.
+Often, this happens because an argument used to be required to turn on a 
feature that then became the default. An example of this
+is `--recursive` which became the default behavior for all folders passed-in 
starting with 5.0.0.
+
+## W0502: Deprecated CLI flags were included that will safely be remapped.
+
+This warning will be shown if a CLI flag is passed into the isort command that 
is no longer supported but can safely be remapped to the new version of the 
flag. If you encounter this warning, you must update the argument to match the 
new flag
+before the next major release.
+
+## W0503: Deprecated config options were ignored.
+
+This warning will be shown if a deprecated config option is defined in the 
Project's isort config file, but can safely be ignored.
+This is similar to `W0500` but dealing with config files rather than CLI flags.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/isort/_version.py 
new/isort-5.4.2/isort/_version.py
--- old/isort-5.3.2/isort/_version.py   2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/isort/_version.py   2020-08-15 05:12:38.000000000 +0200
@@ -1 +1 @@
-__version__ = "5.3.2"
+__version__ = "5.4.2"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/isort/deprecated/finders.py 
new/isort-5.4.2/isort/deprecated/finders.py
--- old/isort-5.3.2/isort/deprecated/finders.py 2020-08-07 10:21:51.000000000 
+0200
+++ new/isort-5.4.2/isort/deprecated/finders.py 2020-08-15 05:12:38.000000000 
+0200
@@ -85,14 +85,13 @@
                 regexp = "^" + known_pattern.replace("*", ".*").replace("?", 
".?") + "$"
                 self.known_patterns.append((re.compile(regexp), placement))
 
-    @staticmethod
-    def _parse_known_pattern(pattern: str) -> List[str]:
+    def _parse_known_pattern(self, pattern: str) -> List[str]:
         """Expand pattern if identified as a directory and return found sub 
packages"""
         if pattern.endswith(os.path.sep):
             patterns = [
                 filename
-                for filename in os.listdir(pattern)
-                if os.path.isdir(os.path.join(pattern, filename))
+                for filename in os.listdir(os.path.join(self.config.directory, 
pattern))
+                if os.path.isdir(os.path.join(self.config.directory, pattern, 
filename))
             ]
         else:
             patterns = [pattern]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/isort/main.py 
new/isort-5.4.2/isort/main.py
--- old/isort-5.3.2/isort/main.py       2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/isort/main.py       2020-08-15 05:12:38.000000000 +0200
@@ -328,6 +328,13 @@
         action="store_true",
     )
     parser.add_argument(
+        "--lss",
+        "--length-sort-straight",
+        help="Sort straight imports by their string length.",
+        dest="length_sort_straight",
+        action="store_true",
+    )
+    parser.add_argument(
         "-m",
         "--multi-line",
         dest="multi_line_output",
@@ -335,7 +342,9 @@
         + [str(mode.value) for mode in WrapModes.__members__.values()],
         type=str,
         help="Multi line output (0-grid, 1-vertical, 2-hanging, 
3-vert-hanging, 4-vert-grid, "
-        "5-vert-grid-grouped, 6-vert-grid-grouped-no-comma).",
+        "5-vert-grid-grouped, 6-vert-grid-grouped-no-comma, 7-noqa, "
+        "8-vertical-hanging-indent-bracket, 
9-vertical-prefix-from-module-import, "
+        "10-hanging-indent-with-parentheses).",
     )
     parser.add_argument(
         "-n",
@@ -453,7 +462,7 @@
         "--skip-gitignore",
         action="store_true",
         dest="skip_gitignore",
-        help="Treat project as a git respository and ignore files listed in 
.gitignore",
+        help="Treat project as a git repository and ignore files listed in 
.gitignore",
     )
     inline_args_group.add_argument(
         "--sl",
@@ -736,6 +745,7 @@
         arguments["remapped_deprecated_args"] = remapped_deprecated_args
     if "dont_order_by_type" in arguments:
         arguments["order_by_type"] = False
+        del arguments["dont_order_by_type"]
     multi_line_output = arguments.get("multi_line_output", None)
     if multi_line_output:
         if multi_line_output.isdigit():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/isort/output.py 
new/isort-5.4.2/isort/output.py
--- old/isort-5.3.2/isort/output.py     2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/isort/output.py     2020-08-15 05:12:38.000000000 +0200
@@ -51,7 +51,10 @@
     for section in sections:
         straight_modules = parsed.imports[section]["straight"]
         straight_modules = sorting.naturally(
-            straight_modules, key=lambda key: sorting.module_key(key, config, 
section_name=section)
+            straight_modules,
+            key=lambda key: sorting.module_key(
+                key, config, section_name=section, straight_import=True
+            ),
         )
         from_modules = parsed.imports[section]["from"]
         from_modules = sorting.naturally(
@@ -298,6 +301,11 @@
                 new_section_output.extend(above_comments)
 
             if "*" in from_imports and config.combine_star:
+                if config.combine_as_imports:
+                    comments = list(comments or ())
+                    comments += parsed.categorized_comments["from"].pop(
+                        f"{module}.__combined_as__", []
+                    )
                 import_statement = wrap.line(
                     with_comments(
                         comments,
@@ -382,7 +390,6 @@
                         for as_import in as_imports[from_import]
                     )
 
-                star_import = False
                 if "*" in from_imports:
                     new_section_output.append(
                         with_comments(
@@ -393,7 +400,6 @@
                         )
                     )
                     from_imports.remove("*")
-                    star_import = True
                     comments = None
 
                 for from_import in copy.copy(from_imports):
@@ -425,15 +431,16 @@
                     )
                 ):
                     from_import_section.append(from_imports.pop(0))
-                if star_import:
-                    import_statement = import_start + (", 
").join(from_import_section)
-                else:
-                    import_statement = with_comments(
-                        comments,
-                        import_start + (", ").join(from_import_section),
-                        removed=config.ignore_comments,
-                        comment_prefix=config.comment_prefix,
+                if config.combine_as_imports:
+                    comments = (comments or []) + list(
+                        
parsed.categorized_comments["from"].pop(f"{module}.__combined_as__", ())
                     )
+                import_statement = with_comments(
+                    comments,
+                    import_start + (", ").join(from_import_section),
+                    removed=config.ignore_comments,
+                    comment_prefix=config.comment_prefix,
+                )
                 if not from_import_section:
                     import_statement = ""
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/isort/parse.py 
new/isort-5.4.2/isort/parse.py
--- old/isort-5.3.2/isort/parse.py      2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/isort/parse.py      2020-08-15 05:12:38.000000000 +0200
@@ -320,10 +320,12 @@
             if "as" in just_imports and (just_imports.index("as") + 1) < 
len(just_imports):
                 straight_import = False
                 while "as" in just_imports:
+                    nested_module = None
                     as_index = just_imports.index("as")
                     if type_of_import == "from":
                         nested_module = just_imports[as_index - 1]
-                        module = just_imports[0] + "." + nested_module
+                        top_level_module = just_imports[0]
+                        module = top_level_module + "." + nested_module
                         as_name = just_imports[as_index + 1]
                         if nested_module == as_name and 
config.remove_redundant_aliases:
                             pass
@@ -336,7 +338,13 @@
                             pass
                         elif as_name not in as_map["straight"][module]:
                             as_map["straight"][module].append(as_name)
-                    if not config.combine_as_imports:
+
+                    if config.combine_as_imports and nested_module:
+                        categorized_comments["from"].setdefault(
+                            f"{top_level_module}.__combined_as__", []
+                        ).extend(comments)
+                        comments = []
+                    else:
                         categorized_comments["straight"][module] = comments
                         comments = []
                     del just_imports[as_index : as_index + 2]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/isort/settings.py 
new/isort-5.4.2/isort/settings.py
--- old/isort-5.3.2/isort/settings.py   2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/isort/settings.py   2020-08-15 05:12:38.000000000 +0200
@@ -132,6 +132,7 @@
     indent: str = " " * 4
     comment_prefix: str = "  #"
     length_sort: bool = False
+    length_sort_straight: bool = False
     length_sort_sections: FrozenSet[str] = frozenset()
     add_imports: FrozenSet[str] = frozenset()
     remove_imports: FrozenSet[str] = frozenset()
@@ -522,14 +523,13 @@
         self._section_comments = tuple(f"# {heading}" for heading in 
self.import_headings.values())
         return self._section_comments
 
-    @staticmethod
-    def _parse_known_pattern(pattern: str) -> List[str]:
+    def _parse_known_pattern(self, pattern: str) -> List[str]:
         """Expand pattern if identified as a directory and return found sub 
packages"""
         if pattern.endswith(os.path.sep):
             patterns = [
                 filename
-                for filename in os.listdir(pattern)
-                if os.path.isdir(os.path.join(pattern, filename))
+                for filename in os.listdir(os.path.join(self.directory, 
pattern))
+                if os.path.isdir(os.path.join(self.directory, pattern, 
filename))
             ]
         else:
             patterns = [pattern]
@@ -653,7 +653,9 @@
                     float("inf") if max_line_length == "off" else 
int(max_line_length)
                 )
             settings = {
-                key: value for key, value in settings.items() if key in 
_DEFAULT_SETTINGS.keys()
+                key: value
+                for key, value in settings.items()
+                if key in _DEFAULT_SETTINGS.keys() or 
key.startswith(KNOWN_PREFIX)
             }
 
         for key, value in settings.items():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/isort/sorting.py 
new/isort-5.4.2/isort/sorting.py
--- old/isort-5.3.2/isort/sorting.py    2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/isort/sorting.py    2020-08-15 05:12:38.000000000 +0200
@@ -13,6 +13,7 @@
     sub_imports: bool = False,
     ignore_case: bool = False,
     section_name: Optional[Any] = None,
+    straight_import: Optional[bool] = False,
 ) -> str:
     match = re.match(r"^(\.+)\s*(.*)", module_name)
     if match:
@@ -41,7 +42,11 @@
     if not config.case_sensitive:
         module_name = module_name.lower()
 
-    length_sort = config.length_sort or str(section_name).lower() in 
config.length_sort_sections
+    length_sort = (
+        config.length_sort
+        or (config.length_sort_straight and straight_import)
+        or str(section_name).lower() in config.length_sort_sections
+    )
     _length_sort_maybe = length_sort and (str(len(module_name)) + ":" + 
module_name) or module_name
     return f"{module_name in config.force_to_top and 'A' or 
'B'}{prefix}{_length_sort_maybe}"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/pyproject.toml 
new/isort-5.4.2/pyproject.toml
--- old/isort-5.3.2/pyproject.toml      2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/pyproject.toml      2020-08-15 05:12:38.000000000 +0200
@@ -3,7 +3,7 @@
 
 [tool.poetry]
 name = "isort"
-version = "5.3.2"
+version = "5.4.2"
 description = "A Python utility / library to sort Python imports."
 authors = ["Timothy Crosley <[email protected]>"]
 license = "MIT"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/tests/test_isort.py 
new/isort-5.4.2/tests/test_isort.py
--- old/isort-5.3.2/tests/test_isort.py 2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/tests/test_isort.py 2020-08-15 05:12:38.000000000 +0200
@@ -30,6 +30,8 @@
 indent_size = 4
 known_first_party = isort
 known_third_party = kate
+known_something_else = something_entirely_different
+sections = FUTURE, STDLIB, THIRDPARTY, FIRSTPARTY, LOCALFOLDER, SOMETHING_ELSE
 ignore_frosted_errors = E103
 skip = build,.tox,venv
 balanced_wrapping = true
@@ -52,9 +54,12 @@
 def default_settings_path(tmpdir_factory) -> Iterator[str]:
     config_dir = tmpdir_factory.mktemp("config")
     config_file = config_dir.join(".editorconfig").strpath
+
     with open(config_file, "w") as editorconfig:
         editorconfig.write(TEST_DEFAULT_CONFIG)
 
+    assert Config(config_file).known_other
+
     with config_dir.as_cwd():
         yield config_dir.strpath
 
@@ -605,11 +610,33 @@
     )
 
 
+def test_length_sort_straight() -> None:
+    """Test setting isort to sort straight imports on length instead of 
alphabetically."""
+    test_input = (
+        "import medium_sizeeeeeeeeeeeeee\n"
+        "import shortie\n"
+        "import looooooooooooooooooooooooooooooooooooooong\n"
+        "from medium_sizeeeeeeeeeeeeee import b\n"
+        "from shortie import c\n"
+        "from looooooooooooooooooooooooooooooooooooooong import a\n"
+    )
+    test_output = isort.code(test_input, length_sort_straight=True)
+    assert test_output == (
+        "import shortie\n"
+        "import medium_sizeeeeeeeeeeeeee\n"
+        "import looooooooooooooooooooooooooooooooooooooong\n"
+        "from looooooooooooooooooooooooooooooooooooooong import a\n"
+        "from medium_sizeeeeeeeeeeeeee import b\n"
+        "from shortie import c\n"
+    )
+
+
 def test_length_sort_section() -> None:
     """Test setting isort to sort on length instead of alphabetically for a 
specific section."""
     test_input = (
         "import medium_sizeeeeeeeeeeeeee\n"
         "import shortie\n"
+        "import datetime\n"
         "import sys\n"
         "import os\n"
         "import looooooooooooooooooooooooooooooooooooooong\n"
@@ -619,6 +646,7 @@
     assert test_output == (
         "import os\n"
         "import sys\n"
+        "import datetime\n"
         "\n"
         "import looooooooooooooooooooooooooooooooooooooong\n"
         "import medium_sizeeeeeeeeeeeeea\n"
@@ -1044,27 +1072,33 @@
     assert test_output == "import os\nimport sys\n\nimport profile.test\n"
 
 
-def test_known_pattern_path_expansion() -> None:
+def test_known_pattern_path_expansion(tmpdir) -> None:
     """Test to ensure patterns ending with path sep gets expanded
     and nested packages treated as known patterns.
     """
+    src_dir = tmpdir.mkdir("src")
+    src_dir.mkdir("foo")
+    src_dir.mkdir("bar")
     test_input = (
         "from kate_plugin import isort_plugin\n"
         "import sys\n"
-        "import isort.settings\n"
+        "from foo import settings\n"
+        "import bar\n"
         "import this\n"
         "import os\n"
     )
     test_output = isort.code(
         code=test_input,
         default_section="THIRDPARTY",
-        known_first_party=["./", "this", "kate_plugin", "isort"],
+        known_first_party=["src/", "this", "kate_plugin"],
+        directory=str(tmpdir),
     )
     test_output_old_finder = isort.code(
         code=test_input,
         default_section="FIRSTPARTY",
         old_finders=True,
-        known_first_party=["./", "this", "kate_plugin", "isort"],
+        known_first_party=["src/", "this", "kate_plugin"],
+        directory=str(tmpdir),
     )
     assert (
         test_output_old_finder
@@ -1073,8 +1107,9 @@
             "import os\n"
             "import sys\n"
             "\n"
-            "import isort.settings\n"
+            "import bar\n"
             "import this\n"
+            "from foo import settings\n"
             "from kate_plugin import isort_plugin\n"
         )
     )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/tests/test_main.py 
new/isort-5.4.2/tests/test_main.py
--- old/isort-5.3.2/tests/test_main.py  2020-08-07 10:21:51.000000000 +0200
+++ new/isort-5.4.2/tests/test_main.py  2020-08-15 05:12:38.000000000 +0200
@@ -39,6 +39,8 @@
     assert main.parse_args([]) == {}
     assert main.parse_args(["--multi-line", "1"]) == {"multi_line_output": 
WrapModes.VERTICAL}
     assert main.parse_args(["--multi-line", "GRID"]) == {"multi_line_output": 
WrapModes.GRID}
+    assert main.parse_args(["--dont-order-by-type"]) == {"order_by_type": 
False}
+    assert main.parse_args(["--dt"]) == {"order_by_type": False}
 
 
 def test_ascii_art(capsys):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/isort-5.3.2/tests/test_regressions.py 
new/isort-5.4.2/tests/test_regressions.py
--- old/isort-5.3.2/tests/test_regressions.py   2020-08-07 10:21:51.000000000 
+0200
+++ new/isort-5.4.2/tests/test_regressions.py   2020-08-15 05:12:38.000000000 
+0200
@@ -492,3 +492,46 @@
     assert diff_output.read().endswith(
         "-1,5 +1,5 @@\n+import a\r\n import b\r\n" "-import a\r\n \r\n \r\n 
def func():\r\n"
     )
+
+
+def test_combine_as_does_not_lose_comments_issue_1321():
+    """Test to ensure isort doesn't lose comments when --combine-as is used.
+    See: https://github.com/timothycrosley/isort/issues/1321
+    """
+    test_input = """
+from foo import *  # noqa
+from foo import bar as quux  # other
+from foo import x as a  # noqa
+
+import operator as op  # op comment
+import datetime as dtime  # dtime comment
+
+from datetime import date as d  # dcomm
+from datetime import datetime as dt  # dtcomm
+"""
+
+    expected_output = """
+import datetime as dtime  # dtime comment
+import operator as op  # op comment
+from datetime import date as d, datetime as dt  # dcomm; dtcomm
+
+from foo import *  # noqa
+from foo import bar as quux, x as a  # other; noqa
+"""
+
+    assert isort.code(test_input, combine_as_imports=True) == expected_output
+
+
+def test_combine_as_does_not_lose_comments_issue_1381():
+    """Test to ensure isort doesn't lose comments when --combine-as is used.
+    See: https://github.com/timothycrosley/isort/issues/1381
+    """
+    test_input = """
+from smtplib import SMTPConnectError, SMTPNotSupportedError  # important 
comment
+"""
+    assert "# important comment" in isort.code(test_input, 
combine_as_imports=True)
+
+    test_input = """
+from appsettings import AppSettings, ObjectSetting, StringSetting  # type: 
ignore
+"""
+    assert "# type: ignore" in isort.code(test_input, combine_as_imports=True)

++++++ isort-5.3.2-gh.tar.gz -> isort-5.4.2.tar.gz ++++++
++++ 7435 lines of diff (skipped)


Reply via email to