E52F bpo-30109: Fix reindent.py by Mariatta · Pull Request #1207 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-30109: Fix reindent.py#1207

Merged
Mariatta merged 2 commits intopython:masterfrom
Mariat 8000 ta:bpo-30109
Apr 20, 2017
Merged

bpo-30109: Fix reindent.py#1207
Mariatta merged 2 commits intopython:masterfrom
Mariatta:bpo-30109

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.


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

0