Issue 20900: distutils register command should print text, not bytes repr (original) (raw)

Created on 2014-03-12 20:59 by eric.araujo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue20900.patch ingrid,2014-03-15 19:20 review
Messages (11)
msg213295 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-12 20:59
“python3 setup.py register --show-response“ will display something like "----------b'xxx'----------". The HTTP response body should be decoded to text for display, instead of the repr of a bytes object. Setting the “easy” keyword: thanks to unittest.mock, writing a test for this should not be hard, and with a test we can have the confidence to change the code.
msg213310 - (view) Author: (ingrid) * Date: 2014-03-12 22:26
I haven't had to register a python package before. Is there a way to reproduce this without actually creating an entry in PyPI?
msg213313 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-12 22:32
To get a better idea of the problem, you can run the code for real using https://testpypi.python.org/pypi as repository URL. Then, unittest.mock provides a way to write a unit test that reproduces the bug without actually sending an HTTP request to any server.
msg213315 - (view) Author: (ingrid) * Date: 2014-03-12 22:39
Ah, thanks! I'm looking at this now.
msg213676 - (view) Author: (ingrid) * Date: 2014-03-15 19:20
Here is a patch. I made the register show-response format consistent with the upload show-response format and added tests for both. Please let me know if you have any feedback.
msg213688 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-15 22:19
Thank you, the patch looks excellent. I’ll apply it in a day or two.
msg213944 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-18 05:47
Were you able to reproduce the bug before you changed the code? I saw clean text when registering a release with success, and clean text too when trying to register a release for a project I was not owner of.
msg214097 - (view) Author: (ingrid) * Date: 2014-03-19 14:38
I'm not quite clear on what you mean, could you please post an example output? Initially the response was not showing up at all for me because the announce call in register was missing a log level, but when I used log.INFO, the response did print for me, and it did look something like "----------b'xxx'----------". On a side note, the announce function defined in cmd.py seems to default to a log level 1, and messages with a log level of 1 do not seem to be printed to stdout regardless of what self.verbose is set to. I'm not sure if that is intentional or a bug, but I thought it was worth mentioning.
msg268140 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-10 18:35
.patch looks good to me. We are already testing output of "python -setup.py upload --show-response" in Lib/distutils/tests/test_upload.py so I removed test_show_reponse and tweaked test_upload to test the whole line: - self.assertIn('xyzzy\n', results[-1]) + self.assertEqual(results[-1], 75 * '-' + '\nxyzzy\n' + 75 * '-')
msg268150 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-10 20:02
New changeset 02824cee7624 by Berker Peksag in branch '3.5': Issue #20900: distutils register command now decodes HTTP responses correctly https://hg.python.org/cpython/rev/02824cee7624 New changeset b0be24a2f16c by Berker Peksag in branch 'default': Issue #20900: Merge from 3.5 https://hg.python.org/cpython/rev/b0be24a2f16c
msg268151 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-10 20:04
Thanks for the patch ingrid!
History
Date User Action Args
2022-04-11 14:57:59 admin set github: 65099
2016-06-10 20:04:09 berker.peksag set status: open -> closedmessages: + assignee: eric.araujo -> resolution: fixedstage: patch review -> resolved
2016-06-10 20:02:06 python-dev set nosy: + python-devmessages: +
2016-06-10 18:35:59 berker.peksag set nosy: + berker.peksagmessages: + versions: + Python 3.5, Python 3.6, - Python 3.3, Python 3.4
2014-03-19 14:38:25 ingrid set messages: +
2014-03-18 05:47:20 eric.araujo set messages: +
2014-03-15 22:19:20 eric.araujo set assignee: eric.araujomessages: + stage: needs patch -> patch review
2014-03-15 19:20:54 ingrid set files: + issue20900.patchkeywords: + patchmessages: +
2014-03-12 22:39:47 ingrid set messages: +
2014-03-12 22:32:30 eric.araujo set messages: +
2014-03-12 22:26:58 ingrid set nosy: + ingridmessages: +
2014-03-12 21:04:26 Arfrever set nosy: + Arfrever
2014-03-12 20:59:23 eric.araujo create