mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 03:14:21 +00:00
Merge branch '3703.integration-tests-python-3' into 3707-more-integration-python-3
This commit is contained in:
commit
a843210b26
@ -28,7 +28,7 @@ from twisted.internet.error import (
|
||||
import pytest
|
||||
import pytest_twisted
|
||||
|
||||
from util import (
|
||||
from .util import (
|
||||
_CollectOutputProtocol,
|
||||
_MagicTextProtocol,
|
||||
_DumpOutputProtocol,
|
||||
|
@ -1,9 +1,21 @@
|
||||
"""
|
||||
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.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
|
||||
|
||||
import sys
|
||||
from os.path import join
|
||||
|
||||
from twisted.internet.error import ProcessTerminated
|
||||
|
||||
import util
|
||||
from . import util
|
||||
|
||||
import pytest_twisted
|
||||
|
||||
@ -42,4 +54,4 @@ def test_upload_immutable(reactor, temp_dir, introducer_furl, flog_gatherer, sto
|
||||
assert isinstance(e, ProcessTerminated)
|
||||
|
||||
output = proto.output.getvalue()
|
||||
assert "shares could be placed on only" in output
|
||||
assert b"shares could be placed on only" in output
|
||||
|
@ -5,7 +5,7 @@ import time
|
||||
import json
|
||||
from os import mkdir, environ
|
||||
from os.path import exists, join
|
||||
from six.moves import StringIO
|
||||
from io import StringIO, BytesIO
|
||||
from functools import partial
|
||||
from subprocess import check_output
|
||||
|
||||
@ -59,7 +59,7 @@ class _CollectOutputProtocol(ProcessProtocol):
|
||||
"""
|
||||
def __init__(self):
|
||||
self.done = Deferred()
|
||||
self.output = StringIO()
|
||||
self.output = BytesIO()
|
||||
|
||||
def processEnded(self, reason):
|
||||
if not self.done.called:
|
||||
@ -73,7 +73,7 @@ class _CollectOutputProtocol(ProcessProtocol):
|
||||
self.output.write(data)
|
||||
|
||||
def errReceived(self, data):
|
||||
print("ERR: {}".format(data))
|
||||
print("ERR: {!r}".format(data))
|
||||
self.output.write(data)
|
||||
|
||||
|
||||
@ -94,9 +94,11 @@ class _DumpOutputProtocol(ProcessProtocol):
|
||||
self.done.errback(reason)
|
||||
|
||||
def outReceived(self, data):
|
||||
data = unicode(data, sys.stdout.encoding)
|
||||
self._out.write(data)
|
||||
|
||||
def errReceived(self, data):
|
||||
data = unicode(data, sys.stdout.encoding)
|
||||
self._out.write(data)
|
||||
|
||||
|
||||
@ -116,6 +118,7 @@ class _MagicTextProtocol(ProcessProtocol):
|
||||
self.exited.callback(None)
|
||||
|
||||
def outReceived(self, data):
|
||||
data = unicode(data, sys.stdout.encoding)
|
||||
sys.stdout.write(data)
|
||||
self._output.write(data)
|
||||
if not self.magic_seen.called and self._magic_text in self._output.getvalue():
|
||||
@ -123,6 +126,7 @@ class _MagicTextProtocol(ProcessProtocol):
|
||||
self.magic_seen.callback(self)
|
||||
|
||||
def errReceived(self, data):
|
||||
data = unicode(data, sys.stderr.encoding)
|
||||
sys.stdout.write(data)
|
||||
|
||||
|
||||
@ -282,7 +286,7 @@ def _create_node(reactor, request, temp_dir, introducer_furl, flog_gatherer, nam
|
||||
config,
|
||||
u'node',
|
||||
u'log_gatherer.furl',
|
||||
flog_gatherer.decode("utf-8"),
|
||||
flog_gatherer,
|
||||
)
|
||||
write_config(FilePath(config_path), config)
|
||||
created_d.addCallback(created)
|
||||
|
0
newsfragments/3703.minor
Normal file
0
newsfragments/3703.minor
Normal file
@ -218,7 +218,7 @@ class FakeDisplayableServer(StubServer): # type: ignore # tahoe-lafs/ticket/35
|
||||
return self.connected
|
||||
def get_version(self):
|
||||
return {
|
||||
"application-version": "1.0"
|
||||
b"application-version": b"1.0"
|
||||
}
|
||||
def get_permutation_seed(self):
|
||||
return b""
|
||||
|
@ -16,6 +16,15 @@ 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
|
||||
|
||||
|
||||
# Every time a module is added here, also add it to tox.ini environment
|
||||
# integrations3. Bit of duplication, but it's only a handful of files so quite
|
||||
# temporary.
|
||||
PORTED_INTEGRATION_TESTS = [
|
||||
"integration.test_servers_of_happiness",
|
||||
]
|
||||
|
||||
|
||||
# Keep these sorted alphabetically, to reduce merge conflicts:
|
||||
PORTED_MODULES = [
|
||||
"allmydata",
|
||||
|
@ -318,7 +318,7 @@ class Root(MultiFormatResource):
|
||||
}
|
||||
version = server.get_version()
|
||||
if version is not None:
|
||||
description[u"version"] = version["application-version"]
|
||||
description[u"version"] = version[b"application-version"]
|
||||
|
||||
return description
|
||||
|
||||
|
13
tox.ini
13
tox.ini
@ -7,7 +7,7 @@
|
||||
[gh-actions]
|
||||
python =
|
||||
2.7: py27-coverage,codechecks
|
||||
3.6: py36-coverage
|
||||
3.6: py36-coverage,integration3
|
||||
3.7: py37-coverage
|
||||
3.8: py38-coverage
|
||||
3.9: py39-coverage,typechecks,codechecks3
|
||||
@ -96,6 +96,17 @@ commands =
|
||||
coverage report
|
||||
|
||||
|
||||
[testenv:integration3]
|
||||
basepython = python3
|
||||
setenv =
|
||||
COVERAGE_PROCESS_START=.coveragerc
|
||||
commands =
|
||||
# NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures'
|
||||
py.test --timeout=1800 --coverage -v {posargs:integration/test_servers_of_happiness.py}
|
||||
coverage combine
|
||||
coverage report
|
||||
|
||||
|
||||
[testenv:codechecks]
|
||||
basepython = python2.7
|
||||
# On macOS, git inside of towncrier needs $HOME.
|
||||
|
Loading…
x
Reference in New Issue
Block a user