-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support of isort>5 #16
Conversation
Oops, I have a competing PR in #15 😄 |
@akaihola New |
Edit: Ah, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result = SortImports( | ||
file_contents=content, | ||
check=True, | ||
isort.check_code(code=content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this call needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces check=True
and writes error messages to stdout
. See changes in test_main
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the error messages?
And if we do, is there a cleaner way to capture them than stdout
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the error messages?
I don't know... Some tests depend on error messages. Probably, we could raise an exception if check_code
is False
And if we do, is there a cleaner way to capture them than
stdout
?
Hm... isort
has hardcoded prints to write to stdout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I had to include those error messages in the test assertions, because in isort<5
there was no way to get rid of the messages.
Now that we can run isort
without polluting stdout
with error messages, I think we should do that for simplicity's sake, and fix the tests as well – unless we get some benefit from having those error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought check=False
in isort<5
was for this?
I vote to get rid of error messages in another PR in order to keep this PR clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote to get rid of error messages in another PR in order to keep this PR clear.
I created another PR: #17
We'll need this in [options.extras_require]
isort =
isort>=5.0.1 (There seems to be a bug in |
isort
version 5.0.x support stephrdev/pytest-isort#24