All tests pass on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-03-18 11:00:49 -04:00
parent 919930173e
commit 2f25950944
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
from __future__ import print_function
import os
from six.moves import cStringIO as StringIO
from io import BytesIO
from six.moves import urllib, http_client
import six
import allmydata # for __full_version__
@ -39,8 +39,8 @@ class BadResponse(object):
def do_http(method, url, body=""):
if isinstance(body, str):
body = StringIO(body)
if isinstance(body, bytes):
body = BytesIO(body)
elif isinstance(body, six.text_type):
raise TypeError("do_http body must be a bytestring, not unicode")
else:

View File

@ -32,7 +32,7 @@ def _get_json_for_fragment(options, fragment, method='GET', post_args=None):
body = ''
if post_args is not None:
raise ValueError("post_args= only valid for POST method")
resp = do_http(method, url, body=body)
resp = do_http(method, url, body=body.encode("utf-8"))
if isinstance(resp, BadResponse):
# specifically NOT using format_http_error() here because the
# URL is pretty sensitive (we're doing /uri/<key>).

View File

@ -95,8 +95,8 @@ class Integration(GridTestMixin, CLITestMixin, unittest.TestCase):
d = self.do_cli('status')# '--verbose')
def _check(ign):
code, stdout, stdin = ign
self.assertEqual(code, 0)
code, stdout, stderr = ign
self.assertEqual(code, 0, stderr)
self.assertTrue('Skipped 1' in stdout)
d.addCallback(_check)
return d