Conversation
Skip the file if it has bad encoding. https://bugs.python.org/issue30109
Lib/test/test_tools/test_reindent.py
Outdated
|
|
||
| def test_reindent_file_with_bad_encoding(self): | ||
| bad_coding_path = os.path.join( | ||
| os.path.dirname(os.path.realpath(__file__)), '../bad_coding.py') |
There was a problem hiding this comment.
os.path.join(..., os.pardir, 'bad_coding.py')
It is common also to use support.findfile().
There was a problem hiding this comment.
Thanks :) I changed to findfile().
Lib/test/test_tools/test_reindent.py
Outdated
| 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'') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Changed to assertNotEqual :)
Use support.findfile Use assertNotEqual
|
Thanks @serhiy-storchaka :) |
Skip the file if it has bad encoding. (cherry picked from commit 58f3c9d)
Skip the file if it has bad encoding. (cherry picked from commit 58f3c9d)
|
Thanks @Mariatta for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7. |
|
Sorry, @Mariatta, I could not cleanly backport this to |
|
Backport to 2.7 has been done in #5637. |
|
GH-5637 is a backport of this pull request to the 2.7 branch. |
Skip the file if it has bad encoding.
https://bugs.python.org/issue30109