Port eliotutil and tests to Python 3.

This commit is contained in:
Itamar Turner-Trauring 2020-12-15 10:13:46 -05:00
parent 7458ea6345
commit 4a587836a5
5 changed files with 21 additions and 6 deletions

0
newsfragments/3560.minor Normal file
View File

View File

@ -34,10 +34,6 @@ python.pkgs.buildPythonPackage rec {
rm src/allmydata/test/cli/test_create.py
rm src/allmydata/test/test_client.py
rm src/allmydata/test/test_runner.py
# Some eliot code changes behavior based on whether stdout is a tty or not
# and fails when it is not.
rm src/allmydata/test/test_eliotutil.py
'';

View File

@ -1,5 +1,7 @@
"""
Tests for ``allmydata.test.eliotutil``.
Tests for ``allmydata.util.eliotutil``.
Ported to Python 3.
"""
from __future__ import (
@ -9,6 +11,10 @@ from __future__ import (
division,
)
from future.utils import 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 sys import stdout
import logging

View File

@ -90,6 +90,7 @@ PORTED_MODULES = [
"allmydata.util.connection_status",
"allmydata.util.deferredutil",
"allmydata.util.dictutil",
"allmydata.util.eliotutil",
"allmydata.util.encodingutil",
"allmydata.util.fileutil",
"allmydata.util.gcutil",
@ -140,6 +141,7 @@ PORTED_TEST_MODULES = [
"allmydata.test.test_dictutil",
"allmydata.test.test_dirnode",
"allmydata.test.test_download",
"allmydata.test.test_eliotutil",
"allmydata.test.test_encode",
"allmydata.test.test_encodingutil",
"allmydata.test.test_filenode",

View File

@ -1,6 +1,12 @@
"""
Tools aimed at the interaction between Tahoe-LAFS implementation and Eliot.
Ported to Python 3.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import (
unicode_literals,
@ -18,6 +24,11 @@ __all__ = [
"validateSetMembership",
]
from future.utils import 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 six import ensure_text
from sys import (
stdout,
)
@ -228,7 +239,7 @@ def _stdlib_logging_to_eliot_configuration(stdlib_logger, eliot_logger=None):
class _DestinationParser(object):
def parse(self, description):
description = description.decode(u"ascii")
description = ensure_text(description)
try:
kind, args = description.split(u":", 1)