msg213295 - (view) |
Author: Éric Araujo (eric.araujo) *  |
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) *  |
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) *  |
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) *  |
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) *  |
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)  |
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) *  |
Date: 2016-06-10 20:04 |
Thanks for the patch ingrid! |
|
|