Skip to content

Commit 5e44c66

Browse files
committedOct 7, 2021
Add test coverage
1 parent 4435942 commit 5e44c66

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
 

‎tests/unit/test_main.py

+20
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,9 @@ def main_check(args):
12151215

12161216

12171217
def test_multiple_configs(capsys, tmpdir):
1218+
# Ensure that --resolve-all-configs flag resolves multiple configs correctly
1219+
# and sorts files corresponding to their nearest config
1220+
12181221
setup_cfg = """
12191222
[isort]
12201223
from_first=True
@@ -1297,3 +1300,20 @@ def test_multiple_configs(capsys, tmpdir):
12971300
from a import x, y, z
12981301
"""
12991302
)
1303+
1304+
# Ensure that --resolve-all-config flags works with --check
1305+
1306+
file5 = dir1 / "file5.py"
1307+
file5.write(
1308+
"""
1309+
import b
1310+
from a import x, y, z
1311+
"""
1312+
)
1313+
1314+
with pytest.raises(SystemExit):
1315+
main.main([str(tmpdir), "--resolve-all-configs", "--cr", str(tmpdir), "--check"])
1316+
1317+
_, err = capsys.readouterr()
1318+
1319+
assert f"{str(file5)} Imports are incorrectly sorted and/or formatted" in err

0 commit comments

Comments
 (0)
Please sign in to comment.