Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37882884
en ru br
Репозитории ALT

Группа :: Development/Python3
Пакет: python3-module-isort

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: python3-module-isort-5.12.0-alt.patch
Скачать


 isort/settings.py                     |  2 +-
 tests/unit/test_deprecated_finders.py | 14 ++++++++++++++
 tests/unit/test_ticketed_features.py  | 35 +++++++++++++++++++++++++----------
 3 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/isort/settings.py b/isort/settings.py
index fb9bba2f..9be3e128 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -48,7 +48,7 @@ from .wrap_modes import from_string as wrap_mode_from_string
 if TYPE_CHECKING:
     tomli: Any
 else:
-    from ._vendored import tomli
+    import tomli
 
 _SHEBANG_RE = re.compile(rb"^#!.*\bpython[23w]?\b")
 CYTHON_EXTENSIONS = frozenset({"pyx", "pxd"})
diff --git a/tests/unit/test_deprecated_finders.py b/tests/unit/test_deprecated_finders.py
index 3d715c2e..39118274 100644
--- a/tests/unit/test_deprecated_finders.py
+++ b/tests/unit/test_deprecated_finders.py
@@ -4,6 +4,8 @@ import posixpath
 from pathlib import Path
 from unittest.mock import patch
 
+import pytest
+
 from isort import sections, settings
 from isort.deprecated import finders
 from isort.deprecated.finders import FindersManager
@@ -130,12 +132,20 @@ class TestRequirementsFinder(AbstractTestFinder):
         test_finder.enabled = False
         assert not test_finder.find("isort")
 
+    @pytest.mark.skipif(
+        finders.parse_requirements is None,
+        reason="Requires pip-api",
+    )
     def test_requirements_dir(self, tmpdir):
         tmpdir.mkdir("requirements").join("development.txt").write("x==1.00")
         test_finder = self.kind(settings.DEFAULT_CONFIG, str(tmpdir))
         assert test_finder.find("x")
 
 
+@pytest.mark.skipif(
+    finders.parse_requirements is None,
+    reason="Requires pip-api",
+)
 def test_requirements_finder(tmpdir) -> None:
     subdir = tmpdir.mkdir("subdir").join("lol.txt")
     subdir.write("flask")
@@ -163,6 +173,10 @@ def test_requirements_finder(tmpdir) -> None:
     req_file.remove()
 
 
+@pytest.mark.skipif(
+    finders.Pipfile is None,
+    reason="Requires requirementslib",
+)
 def test_pipfile_finder(tmpdir) -> None:
     pipfile = tmpdir.join("Pipfile")
     pipfile.write(PIPFILE)
diff --git a/tests/unit/test_ticketed_features.py b/tests/unit/test_ticketed_features.py
index 6f483e8f..9eb0fa20 100644
--- a/tests/unit/test_ticketed_features.py
+++ b/tests/unit/test_ticketed_features.py
@@ -9,6 +9,16 @@ import pytest
 import isort
 from isort import Config, exceptions
 
+try:
+    import example_shared_isort_profile
+except ImportError:
+    example_shared_isort_profile = None
+
+try:
+    import example_isort_sorting_plugin
+except ImportError:
+    example_isort_sorting_plugin = None
+
 
 def test_semicolon_ignored_for_dynamic_lines_after_import_issue_1178():
     """Test to ensure even if a semicolon is in the decorator in the line following an import
@@ -227,6 +237,10 @@ import os
     )
 
 
+@pytest.mark.skipif(
+    example_shared_isort_profile is None,
+    reason="Requires example_shared_isort_profile",
+)
 def test_isort_supports_shared_profiles_issue_970():
     """Test to ensure isort provides a way to use shared profiles.
     See: https://github.com/pycqa/isort/issues/970.
@@ -1043,17 +1057,18 @@ def test_sort_configurable_sort_issue_1732() -> None:
             "from bob.apples import aardvark\n"
         )
     )
-    assert (
-        isort.code(test_input, sort_order="natural_plus")
-        == isort.code(test_input)
-        == (
-            "import module9\n"
-            "import module10\n"
-            "import module200\n"
-            "from bob2.apples2 import aardvark as aardvark2\n"
-            "from bob.apples import aardvark\n"
+    if example_isort_sorting_plugin is not None:
+        assert (
+            isort.code(test_input, sort_order="natural_plus")
+            == isort.code(test_input)
+            == (
+                "import module9\n"
+                "import module10\n"
+                "import module200\n"
+                "from bob2.apples2 import aardvark as aardvark2\n"
+                "from bob.apples import aardvark\n"
+            )
         )
-    )
     with pytest.raises(exceptions.SortingFunctionDoesNotExist):
         isort.code(test_input, sort_order="round")
 
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin