Merge branch '3564.eliot-log-testing-python-3' into 3566.web-tests-python-3-part-2

This commit is contained in:
Itamar Turner-Trauring 2020-12-21 13:20:50 -05:00
commit b46898f667
2 changed files with 8 additions and 2 deletions

View File

@ -57,11 +57,14 @@ from ..util.eliotutil import (
_parse_destination_description, _parse_destination_description,
_EliotLogging, _EliotLogging,
) )
from ..util.jsonbytes import BytesJSONEncoder
from .common import ( from .common import (
SyncTestCase, SyncTestCase,
AsyncTestCase, AsyncTestCase,
) )
class EliotLoggedTestTests(AsyncTestCase): class EliotLoggedTestTests(AsyncTestCase):
def test_returns_none(self): def test_returns_none(self):
Message.log(hello="world") Message.log(hello="world")
@ -94,7 +97,7 @@ class ParseDestinationDescriptionTests(SyncTestCase):
reactor = object() reactor = object()
self.assertThat( self.assertThat(
_parse_destination_description("file:-")(reactor), _parse_destination_description("file:-")(reactor),
Equals(FileDestination(stdout)), Equals(FileDestination(stdout, encoder=BytesJSONEncoder)),
) )

View File

@ -86,6 +86,9 @@ from twisted.internet.defer import (
) )
from twisted.application.service import Service from twisted.application.service import Service
from .jsonbytes import BytesJSONEncoder
def validateInstanceOf(t): def validateInstanceOf(t):
""" """
Return an Eliot validator that requires values to be instances of ``t``. Return an Eliot validator that requires values to be instances of ``t``.
@ -302,7 +305,7 @@ class _DestinationParser(object):
rotateLength=rotate_length, rotateLength=rotate_length,
maxRotatedFiles=max_rotated_files, maxRotatedFiles=max_rotated_files,
) )
return lambda reactor: FileDestination(get_file()) return lambda reactor: FileDestination(get_file(), BytesJSONEncoder)
_parse_destination_description = _DestinationParser().parse _parse_destination_description = _DestinationParser().parse