diff options
| author | Timothy Crosley <timothy.crosley@gmail.com> | 2021-07-23 22:47:44 -0700 |
|---|---|---|
| committer | Timothy Crosley <timothy.crosley@gmail.com> | 2021-07-23 22:47:44 -0700 |
| commit | 3afcb2dac3d8208ffeb1400c5208e0a3877923c3 (patch) | |
| tree | c2e71d0adff8193f188c38394773ba4d6cb80c9f /tests/unit | |
| parent | 0d4f1fab342017dddd8b914f71cf6938ac7ac622 (diff) | |
| parent | f3116272c50b3be68d4d3750ae6b6105893d1cc2 (diff) | |
| download | isort-3afcb2dac3d8208ffeb1400c5208e0a3877923c3.tar.gz | |
Merge branch 'main' of https://github.com/timothycrosley/isort
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_isort.py | 4 | ||||
| -rw-r--r-- | tests/unit/test_main.py | 23 |
2 files changed, 25 insertions, 2 deletions
diff --git a/tests/unit/test_isort.py b/tests/unit/test_isort.py index 526a7b8a..f6f905fd 100644 --- a/tests/unit/test_isort.py +++ b/tests/unit/test_isort.py @@ -2708,7 +2708,7 @@ def test_import_by_paren_issue_375() -> None: def test_import_by_paren_issue_460() -> None: - """Test to ensure isort can doesnt move comments around """ + """Test to ensure isort can doesnt move comments around""" test_input = """ # First comment # Second comment @@ -5184,7 +5184,7 @@ def test_only_sections() -> None: def test_combine_straight_imports() -> None: - """ Tests to ensure that combine_straight_imports works correctly """ + """Tests to ensure that combine_straight_imports works correctly""" test_input = ( "import os\n" "import sys\n" "# this is a comment\n" "import math # inline comment\n" diff --git a/tests/unit/test_main.py b/tests/unit/test_main.py index 84cc3e11..2b13f9aa 100644 --- a/tests/unit/test_main.py +++ b/tests/unit/test_main.py @@ -1188,3 +1188,26 @@ nested_dir_ignored out, error = main_check([str(tmpdir), "--skip-gitignore", "--filter-files"]) assert all(f"{str(tmpdir)}{file}" in out for file in should_check) + + # Should work when git project contains symlinks + + if os.name != "nt": + git_project0.join("has_imports_ignored.py").write(import_content) + git_project0.join("has_imports.py").write(import_content) + tmpdir.join("has_imports.py").write(import_content) + tmpdir.join("nested_dir").join("has_imports.py").write(import_content) + git_project0.join("ignore_link.py").mksymlinkto(tmpdir.join("has_imports.py")) + git_project0.join("ignore_link").mksymlinkto(tmpdir.join("nested_dir")) + git_project0.join(".gitignore").write("ignore_link.py\nignore_link", mode="a") + + out, error = main_check( + [str(git_project0), "--skip-gitignore", "--filter-files", "--check"] + ) + + should_check = ["/git_project0/has_imports.py"] + + assert all(f"{str(tmpdir)}{file}" in error for file in should_check) + + out, error = main_check([str(git_project0), "--skip-gitignore", "--filter-files"]) + + assert all(f"{str(tmpdir)}{file}" in out for file in should_check) |
