launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25578
[Merge] ~cjwatson/txpkgupload:twisted-20.3.0 into txpkgupload:master
Colin Watson has proposed merging ~cjwatson/txpkgupload:twisted-20.3.0 into txpkgupload:master.
Commit message:
Upgrade to Twisted 20.3.0
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/txpkgupload/+git/txpkgupload/+merge/392960
Using ClientDirectory as an iterator is now deprecated, so test that opened directories appear empty using directory.read() instead.
Also temporarily monkey-patch around SSHConnection.sendRequest not working on Python 3, borrowing code from the as-yet-unreleased next version.
Dependencies MP: https://code.launchpad.net/~cjwatson/txpkgupload/+git/dependencies/+merge/392959
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/txpkgupload:twisted-20.3.0 into txpkgupload:master.
diff --git a/requirements.txt b/requirements.txt
index 509c146..ce14f15 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,12 +1,12 @@
appdirs==1.4.3
argparse==1.4.0
-asn1crypto==0.23.0
-attrs==17.3.0
+attrs==19.3.0
Automat==0.6.0
+bcrypt==3.1.7
bson==0.5.9
cffi==1.11.4
constantly==15.1.0
-cryptography==2.1.4
+cryptography==3.0
distro==1.4.0
enum34==1.1.6
extras==1.0.0
@@ -32,6 +32,7 @@ oops-wsgi==0.0.14
pbr==1.8.1
pyasn1==0.1.6
pycparser==2.18
+PyHamcrest==1.10.1
python-dateutil==2.8.1
python-gettext==4.0
python-mimeparse==0.1.4
@@ -41,7 +42,7 @@ six==1.12.0
testresources==0.2.7
testtools==2.3.0
traceback2==1.4.0
-Twisted[conch]==18.4.0
+Twisted[conch]==20.3.0
unittest2==1.1.0+lp1
wadllib==1.3.2
zope.browser==2.3
diff --git a/src/txpkgupload/tests/test_plugin.py b/src/txpkgupload/tests/test_plugin.py
index f131364..c3601c8 100644
--- a/src/txpkgupload/tests/test_plugin.py
+++ b/src/txpkgupload/tests/test_plugin.py
@@ -11,6 +11,7 @@ import io
import os
import shutil
import stat
+import struct
import sys
import tempfile
from textwrap import dedent
@@ -40,7 +41,10 @@ from twisted.conch.client.direct import SSHClientFactory
from twisted.conch.scripts.cftp import ClientOptions
from twisted.conch.ssh.channel import SSHChannel
from twisted.conch.ssh.common import NS
-from twisted.conch.ssh.connection import SSHConnection
+from twisted.conch.ssh.connection import (
+ MSG_CHANNEL_REQUEST,
+ SSHConnection,
+ )
from twisted.conch.ssh.filetransfer import (
FileTransferClient,
FXF_CREAT,
@@ -341,6 +345,32 @@ class SFTPConnection(SSHConnection):
SSHConnection.serviceStarted(self)
self.openChannel(SFTPSession())
+ # Patch broken sendRequest in Twisted <= 20.3.0. This will be fixed in
+ # the next release after 20.3.0.
+ def sendRequest(self, channel, requestType, data, wantReply=0):
+ """
+ Send a request to a channel.
+
+ @type channel: subclass of C{SSHChannel}
+ @type requestType: L{bytes}
+ @type data: L{bytes}
+ @type wantReply: L{bool}
+ @rtype C{Deferred}/L{None}
+ """
+ if channel.localClosed:
+ return
+ log.msg('sending request %r' % (requestType))
+ self.transport.sendPacket(
+ MSG_CHANNEL_REQUEST,
+ struct.pack('>L', self.channelsToRemoteChannel[channel])
+ + NS(requestType)
+ + (b'\1' if wantReply else b'\0')
+ + data)
+ if wantReply:
+ d = defer.Deferred()
+ self.deferreds.setdefault(channel.id, []).append(d)
+ return d
+
class FakeAuthServerService(xmlrpc.XMLRPC):
"""A fake version of the Launchpad authserver service."""
@@ -711,9 +741,9 @@ class TestPkgUploadServiceMakerSFTP(TestPkgUploadServiceMakerMixin, TestCase):
yield self.server.createFile(client, "foo/bar/baz", b"fake contents")
directory = yield client.openDirectory(".")
try:
- entry = yield next(directory)
+ yield directory.read()
raise AssertionError("Directory not empty")
- except StopIteration:
+ except EOFError:
pass
yield directory.close()