Some progress towards passing tests on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-03-18 10:42:15 -04:00
parent 34f1f43e95
commit b7d6b97f63
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,9 @@
from __future__ import print_function
from future.builtins import chr
import os
import urllib
from urllib.parse import urlencode, quote as url_quote
import json
@ -25,7 +27,7 @@ def _get_json_for_fragment(options, fragment, method='GET', post_args=None):
if method == 'POST':
if post_args is None:
raise ValueError("Must pass post_args= for POST method")
body = urllib.urlencode(post_args)
body = urlencode(post_args)
else:
body = ''
if post_args is not None:
@ -48,7 +50,7 @@ def _get_json_for_fragment(options, fragment, method='GET', post_args=None):
def _get_json_for_cap(options, cap):
return _get_json_for_fragment(
options,
'uri/%s?t=json' % urllib.quote(cap),
'uri/%s?t=json' % url_quote(cap),
)
def pretty_progress(percent, size=10, ascii=False):
@ -74,8 +76,8 @@ def pretty_progress(percent, size=10, ascii=False):
# unicode 0x2581 -> 2589 are vertical bar chunks, like rainbarf uses
# and following are narrow -> wider bars
part = unichr(0x258f - part) # for smooth bar
# part = unichr(0x2581 + part) # for neater-looking thing
part = chr(0x258f - part) # for smooth bar
# part = chr(0x2581 + part) # for neater-looking thing
# hack for 100+ full so we don't print extra really-narrow/high bar
if percent >= 100.0:

View File

@ -4,7 +4,6 @@ import json
import tempfile
from six.moves import StringIO
from os.path import join
from UserDict import UserDict
from twisted.trial import unittest
from twisted.internet import defer
@ -60,9 +59,8 @@ class ProgressBar(unittest.TestCase):
)
class _FakeOptions(UserDict, object):
class _FakeOptions(dict):
def __init__(self):
super(_FakeOptions, self).__init__()
self._tmp = tempfile.mkdtemp()
os.mkdir(join(self._tmp, 'private'), 0o777)
with open(join(self._tmp, 'private', 'api_auth_token'), 'w') as f: