mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Issue #20900: distutils register command now decodes HTTP responses correctly
Initial patch by ingrid.
This commit is contained in:
parent
87a8bcc221
commit
904a2ef2e2
4 changed files with 21 additions and 4 deletions
|
@ -296,9 +296,9 @@ Your selection [default 1]: ''', log.INFO)
|
||||||
result = 500, str(e)
|
result = 500, str(e)
|
||||||
else:
|
else:
|
||||||
if self.show_response:
|
if self.show_response:
|
||||||
data = result.read()
|
data = self._read_pypi_response(result)
|
||||||
result = 200, 'OK'
|
result = 200, 'OK'
|
||||||
if self.show_response:
|
if self.show_response:
|
||||||
dashes = '-' * 75
|
msg = '\n'.join(('-' * 75, data, '-' * 75))
|
||||||
self.announce('%s%r%s' % (dashes, data, dashes))
|
self.announce(msg, log.INFO)
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -301,6 +301,20 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
||||||
results = self.get_logs(INFO)
|
results = self.get_logs(INFO)
|
||||||
self.assertEqual(results, ['running check', 'xxx'])
|
self.assertEqual(results, ['running check', 'xxx'])
|
||||||
|
|
||||||
|
def test_show_response(self):
|
||||||
|
# test that the --show-response option return a well formatted response
|
||||||
|
cmd = self._get_cmd()
|
||||||
|
inputs = Inputs('1', 'tarek', 'y')
|
||||||
|
register_module.input = inputs.__call__
|
||||||
|
cmd.show_response = 1
|
||||||
|
try:
|
||||||
|
cmd.run()
|
||||||
|
finally:
|
||||||
|
del register_module.input
|
||||||
|
|
||||||
|
results = self.get_logs(INFO)
|
||||||
|
self.assertEqual(results[3], 75 * '-' + '\nxxx\n' + 75 * '-')
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.makeSuite(RegisterTestCase)
|
return unittest.makeSuite(RegisterTestCase)
|
||||||
|
|
|
@ -140,7 +140,7 @@ class uploadTestCase(PyPIRCCommandTestCase):
|
||||||
|
|
||||||
# The PyPI response body was echoed
|
# The PyPI response body was echoed
|
||||||
results = self.get_logs(INFO)
|
results = self.get_logs(INFO)
|
||||||
self.assertIn('xyzzy\n', results[-1])
|
self.assertEqual(results[-1], 75 * '-' + '\nxyzzy\n' + 75 * '-')
|
||||||
|
|
||||||
def test_upload_fails(self):
|
def test_upload_fails(self):
|
||||||
self.next_msg = "Not Found"
|
self.next_msg = "Not Found"
|
||||||
|
|
|
@ -139,6 +139,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #20900: distutils register command now decodes HTTP responses
|
||||||
|
correctly. Initial patch by ingrid.
|
||||||
|
|
||||||
- A new version of typing.py provides several new classes and
|
- A new version of typing.py provides several new classes and
|
||||||
features: @overload outside stubs, Reversible, DefaultDict, Text,
|
features: @overload outside stubs, Reversible, DefaultDict, Text,
|
||||||
ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug
|
ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue