Isort: --diff option is ignored when input is from stdin.

Created on 10 Sep 2020  路  5Comments  路  Source: PyCQA/isort

How to reproduce

echo -e 'import sys\nimport os' | isort - --diff

Actual Behavior

got sorted output (no diff)

import os
import sys

Expected Behavior

Show diff like isort 4.x.x

--- :before 2020-09-10 12:27:51.648963
+++ :after  2020-09-10 12:27:51.648976
@@ -1,2 +1,2 @@
+import os
 import sys
-import os

Version used

5.5.1

bug

Most helpful comment

Thanks for reporting this issue!
I've pushed out a hot-fix release that resolves it and adds an additional test case to hopefully keep the regression from coming back. This can be downloaded from PyPI as version 5.5.2

Thanks!

~Timothy

All 5 comments

Thanks for reporting this issue!
I've pushed out a hot-fix release that resolves it and adds an additional test case to hopefully keep the regression from coming back. This can be downloaded from PyPI as version 5.5.2

Thanks!

~Timothy

5.5.2 solved the issue. Thank you.

@timothycrosley Thanks for the quick fix! Nothing was working for me when upgrading isort to 5.5.1 myself. It seems isort when run from stdin keep regressing. https://github.com/PyCQA/isort/issues/1447 https://github.com/PyCQA/isort/issues/1469 I remember atleast one more.

Do we not have the same dedicated test cases when isort is run from stdin as we have when it's run normally?

@karrtikr I was thinking the same thing! There are tests for stdin, but they are clearly inadequate at the moment. I've added an additional ticket here to track the creation of a more robust test suite for stdin based usage https://github.com/PyCQA/isort/issues/1472

Thanks! That'll help

Was this page helpful?
0 / 5 - 0 ratings