mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-10 23:12:40 +00:00
Python 3 tweaks.
This commit is contained in:
parent
6cf3bc75b6
commit
07a3d1ecd6
@ -38,7 +38,6 @@ import re
|
|||||||
import time
|
import time
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
# On Python 2 this will be the backport.
|
|
||||||
from configparser import NoSectionError
|
from configparser import NoSectionError
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
@ -6,16 +6,12 @@ from __future__ import division
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from future.utils import PY2, PY3
|
from future.utils import PY2
|
||||||
if PY2:
|
if PY2:
|
||||||
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||||
from six import ensure_str
|
|
||||||
|
|
||||||
# We're going to override stdin/stderr, so want to match their behavior on respective Python versions.
|
# We're going to override stdin/stderr, so want to match their behavior on respective Python versions.
|
||||||
if PY3:
|
from io import StringIO
|
||||||
from io import StringIO
|
|
||||||
else:
|
|
||||||
from StringIO import StringIO
|
|
||||||
|
|
||||||
from twisted.python.usage import (
|
from twisted.python.usage import (
|
||||||
UsageError,
|
UsageError,
|
||||||
@ -116,7 +112,7 @@ class AddCertificateOptions(SyncTestCase):
|
|||||||
"""
|
"""
|
||||||
When no data is passed to stdin an error is produced
|
When no data is passed to stdin an error is produced
|
||||||
"""
|
"""
|
||||||
self.tahoe.stdin = StringIO(ensure_str(""))
|
self.tahoe.stdin = StringIO("")
|
||||||
self.tahoe.stderr = StringIO() # suppress message
|
self.tahoe.stderr = StringIO() # suppress message
|
||||||
|
|
||||||
with self.assertRaises(UsageError) as ctx:
|
with self.assertRaises(UsageError) as ctx:
|
||||||
@ -159,7 +155,7 @@ class AddCertificateOptions(SyncTestCase):
|
|||||||
"""
|
"""
|
||||||
Unparseable data produces an error
|
Unparseable data produces an error
|
||||||
"""
|
"""
|
||||||
self.tahoe.stdin = StringIO(ensure_str("{}"))
|
self.tahoe.stdin = StringIO("{}")
|
||||||
self.tahoe.stderr = StringIO() # suppress message
|
self.tahoe.stderr = StringIO() # suppress message
|
||||||
|
|
||||||
with self.assertRaises(UsageError) as ctx:
|
with self.assertRaises(UsageError) as ctx:
|
||||||
|
Loading…
Reference in New Issue
Block a user