Skip to content

Commit

Permalink
Fixed #1469: --diff option is ignored when input is from stdin. Relea…
Browse files Browse the repository at this point in the history
…se hot fix release 5.5.2
  • Loading branch information
timothycrosley committed Sep 10, 2020
1 parent 6a3cc76 commit 7431db7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
NOTE: isort follows the [semver](https://semver.org/) versioning standard.
Find out more about isort's release policy [here](https://pycqa.github.io/isort/docs/major_releases/release_policy/).

### 5.5.2 [Hotfix] September 9, 2020
- Fixed #1469: --diff option is ignored when input is from stdin.

### 5.5.1 September 4, 2020
- Fixed #1454: Ensure indented import sections with import heading and a preceding comment don't cause import sorting loops.
- Fixed #1453: isort error when float to top on almost empty file.
Expand Down
2 changes: 1 addition & 1 deletion isort/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.5.1"
__version__ = "5.5.2"
1 change: 1 addition & 0 deletions isort/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ def main(argv: Optional[Sequence[str]] = None, stdin: Optional[TextIOWrapper] =
input_stream=sys.stdin if stdin is None else stdin,
output_stream=sys.stdout,
config=config,
show_diff=show_diff,
)
else:
skipped: List[str] = []
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ line-length = 100

[tool.poetry]
name = "isort"
version = "5.5.1"
version = "5.5.2"
description = "A Python utility / library to sort Python imports."
authors = ["Timothy Crosley <timothy.crosley@gmail.com>"]
license = "MIT"
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,23 @@ def test_main(capsys, tmpdir):
"""
)

# Should be able to stream diff
input_content = TextIOWrapper(
BytesIO(
b"""
import b
import a
"""
)
)
main.main(config_args + ["-", "--diff"], stdin=input_content)
out, error = capsys.readouterr()
assert not error
assert "+" in out
assert "-" in out
assert "import a" in out
assert "import b" in out

# Should be able to run with just a file
python_file = tmpdir.join("has_imports.py")
python_file.write(
Expand Down

0 comments on commit 7431db7

Please sign in to comment.