Skip to content

bpo-30109: Fix reindent.py #1207

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

Merged
merged 2 commits into from
Apr 20, 2017
Merged

bpo-30109: Fix reindent.py #1207

merged 2 commits into from
Apr 20, 2017

Conversation

Mariatta
Copy link
Member

Skip the file if it has bad encoding.

https://bugs.python.org/issue30109

@mention-bot
Copy link

@Mariatta, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tim-one, @florentx and @jaraco to be potential reviewers.

@@ -23,6 +23,13 @@ def test_help(self):
self.assertEqual(out, b'')
self.assertGreater(err, b'')

def test_reindent_file_with_bad_encoding(self):
bad_coding_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../bad_coding.py')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path.join(..., os.pardir, 'bad_coding.py')

It is common also to use support.findfile().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :) I changed to findfile().

os.path.dirname(os.path.realpath(__file__)), '../bad_coding.py')
rc, out, err = assert_python_ok(self.script, '-r', bad_coding_path)
self.assertEqual(out, b'')
self.assertGreater(err, b'')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think assertNotEqual() is more appropriate here. It produces more detailed report for strings and perhaps will produce more detailed report for bytes in future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to assertNotEqual :)

Use support.findfile
Use assertNotEqual
@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error needs backport to 2.7 labels Apr 20, 2017
@Mariatta Mariatta merged commit 58f3c9d into python:master Apr 20, 2017
@Mariatta Mariatta deleted the bpo-30109 branch April 20, 2017 05:59
@Mariatta
Copy link
Member Author

Thanks @serhiy-storchaka :)

Mariatta added a commit to Mariatta/cpython that referenced this pull request Apr 20, 2017
Skip the file if it has bad encoding.
(cherry picked from commit 58f3c9d)
Mariatta added a commit to Mariatta/cpython that referenced this pull request Apr 20, 2017
Skip the file if it has bad encoding.
(cherry picked from commit 58f3c9d)
Mariatta added a commit that referenced this pull request Apr 20, 2017
Skip the file if it has bad encoding.
(cherry picked from commit 58f3c9d)
Mariatta added a commit that referenced this pull request Apr 20, 2017
Skip the file if it has bad encoding.
(cherry picked from commit 58f3c9d)
@miss-islington
Copy link
Contributor

Thanks @Mariatta for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @Mariatta, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 58f3c9dc8f5626abe09ac9738c34f6ba99ce2972 2.7

@Mariatta
Copy link
Member Author

Backport to 2.7 has been done in #5637.

@bedevere-bot
Copy link

GH-5637 is a backport of this pull request to the 2.7 branch.

@Mariatta Mariatta removed their assignment May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants