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
bpo-23596: Add unit tests for the command line for the gzip module #9775
Conversation
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.
Thanks for the PR @matrixise
Lib/test/test_gzip.py
Outdated
out, err = proc.communicate(bytes_io.getvalue()) | ||
|
||
self.assertEqual(err, b'') | ||
self.assertNotEqual(out, b'') |
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 not an assertEqual(out, self.data)
?
Lib/test/test_gzip.py
Outdated
out, err = proc.communicate(self.data) | ||
|
||
self.assertEqual(err, b'') | ||
self.assertNotEqual(out, b'') |
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 not self.assertEqual(out[:2], b"\x1f\x8b")
(the gzip identification bytes)?
Lib/test/test_gzip.py
Outdated
|
||
def test_decompress_infile_outfile_error(self): | ||
rc, out, err = assert_python_ok('-m', 'gzip', '-d', 'thisisatest.out') | ||
self.assertTrue(out.startswith(b"filename doesn't end in .gz:")) |
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.
Works, but what about an self.assertIn(b"filename doesn't end in .gz:", out)
? Would probably produce a better error message, but does not check if the error is at the begining of the line.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Thanks @matrixise for the PR, and @JulienPalard for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
…ythonGH-9775) Add unit tests for the command line for the gzip module (cherry picked from commit 84eec11) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
GH-9779 is a backport of this pull request to the 3.7 branch. |
…ythonGH-9775) Add unit tests for the command line for the gzip module (cherry picked from commit 84eec11) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
GH-9780 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue23596