Merge lp:~vila/bzr/781140-ftp-test-coverage into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 5960
Proposed branch: lp:~vila/bzr/781140-ftp-test-coverage
Merge into: lp:bzr
Diff against target: 126 lines (+57/-12)
3 files modified
bzrlib/tests/ftp_server/__init__.py (+19/-2)
bzrlib/tests/ftp_server/pyftpdlib_based.py (+33/-10)
doc/en/release-notes/bzr-2.4.txt (+5/-0)
To merge this branch: bzr merge lp:~vila/bzr/781140-ftp-test-coverage
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+63652@code.launchpad.net

Commit message

Support pyftplib-0.6.0 as an ftp test server

Description of the change

We supported two ftp test servers in the past: medusa and pyftpdlib.

Medusa stopped working with python-2.6 due to some
incompatibilities with unicode.

pyftpdlib is not packaged and as such poorly deployed in our ecosystem.

This patch does two things:

- upgrade our test framework to support pyftpdlib 0.6.0,

- disable medusa while keeping the plumbing in place in case the
  unicode issues are addressed in the future. python-3 may help.

Note that the medusa plumbing was removed when we made python-2.6
a requirement. I had to dig a bit to find it back and I like to
keep it disabled (instead of removed) to make it easier to use it
again. An alternative would be fully purge the test framework
from all medusa references but that's more work for little
benefits. Roughly, we try to import and disable support, less
trouble than digging the history.

This patch needs to land before we can deploy pyftpdlib again, be
it on babune or pqm or both.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/7/2011 9:18 AM, Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr/781140-ftp-test-coverage into lp:bzr.

...

> Note that the medusa plumbing was removed when we made python-2.6
> a requirement. I had to dig a bit to find it back and I like to
> keep it disabled (instead of removed) to make it easier to use it
> again. An alternative would be fully purge the test framework
> from all medusa references but that's more work for little
> benefits. Roughly, we try to import and disable support, less
> trouble than digging the history.
>
> This patch needs to land before we can deploy pyftpdlib again, be
> it on babune or pqm or both.

+if pyftplib_version < (0, 6,0):

Spacing is wrong on this one.

Otherwise:
 merge: approve

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3t3MQACgkQJdeBCYSNAAP4vACcDqu5EqBCzq0ZnJki9+zh1dFf
Kp0AoJuuQXKx3Ez4Ni2KlAJ7TvPlYb+c
=Ig3r
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

> +if pyftplib_version < (0, 6,0):
>
> Spacing is wrong on this one.

Yup, was already fixed, review-by-mail-gotcha:-/

>
> Otherwise:
> merge: approve

Thanks.

Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/ftp_server/__init__.py'
--- bzrlib/tests/ftp_server/__init__.py 2011-05-11 11:35:28 +0000
+++ bzrlib/tests/ftp_server/__init__.py 2011-06-07 08:21:37 +0000
@@ -17,10 +17,25 @@
17Facilities to use ftp test servers.17Facilities to use ftp test servers.
18"""18"""
1919
20import sys
21
20from bzrlib import tests22from bzrlib import tests
2123
2224
23try:25try:
26 from bzrlib.tests.ftp_server import medusa_based
27 # medusa is bogus starting with python2.6, since we don't support earlier
28 # pythons anymore, it's currently useless. There is hope though that the
29 # unicode bugs get fixed in the future so we leave it disabled until
30 # then. Keeping the framework in place means that only the following line
31 # will need to be changed. The last tests were conducted with medusa-2.0
32 # -- vila 20110607
33 medusa_available = False
34except ImportError:
35 medusa_available = False
36
37
38try:
24 from bzrlib.tests.ftp_server import pyftpdlib_based39 from bzrlib.tests.ftp_server import pyftpdlib_based
25 pyftpdlib_available = True40 pyftpdlib_available = True
26except ImportError:41except ImportError:
@@ -38,7 +53,7 @@
38 """53 """
3954
40 def _probe(self):55 def _probe(self):
41 return pyftpdlib_available56 return medusa_available or pyftpdlib_available
4257
43 def feature_name(self):58 def feature_name(self):
44 return 'FTPServer'59 return 'FTPServer'
@@ -69,7 +84,9 @@
69 raise tests.UnavailableFeature(FTPServerFeature)84 raise tests.UnavailableFeature(FTPServerFeature)
7085
7186
72if pyftpdlib_available:87if medusa_available:
88 FTPTestServer = medusa_based.FTPTestServer
89elif pyftpdlib_available:
73 FTPTestServer = pyftpdlib_based.FTPTestServer90 FTPTestServer = pyftpdlib_based.FTPTestServer
74else:91else:
75 FTPTestServer = UnavailableFTPTestServer92 FTPTestServer = UnavailableFTPTestServer
7693
=== modified file 'bzrlib/tests/ftp_server/pyftpdlib_based.py'
--- bzrlib/tests/ftp_server/pyftpdlib_based.py 2010-06-30 15:19:36 +0000
+++ bzrlib/tests/ftp_server/pyftpdlib_based.py 2011-06-07 08:21:37 +0000
@@ -34,6 +34,11 @@
34from bzrlib.tests import test_server34from bzrlib.tests import test_server
3535
3636
37# Convert the pyftplib string version into a tuple to avoid traps in string
38# comparison.
39pyftplib_version = tuple(map(int, ftpserver.__ver__.split('.')))
40
41
37class AnonymousWithWriteAccessAuthorizer(ftpserver.DummyAuthorizer):42class AnonymousWithWriteAccessAuthorizer(ftpserver.DummyAuthorizer):
3843
39 def _check_permissions(self, username, perm):44 def _check_permissions(self, username, perm):
@@ -113,16 +118,34 @@
113 self.log('OK SITE CHMOD 0%03o "%s".' % (mode, ftp_path))118 self.log('OK SITE CHMOD 0%03o "%s".' % (mode, ftp_path))
114 self.respond('200 SITE CHMOD succesful.')119 self.respond('200 SITE CHMOD succesful.')
115120
116121 if pyftplib_version >= (0, 6, 0):
117# pyftpdlib says to define SITE commands by declaring ftp_SITE_<CMD> methods,122 def log_cmd(self, cmd, arg, respcode, respstr):
118# but fails to recognize them.123 # base class version choke on unicode, the alternative is to just
119ftpserver.proto_cmds['SITE CHMOD'] = ftpserver._CommandProperty(124 # provide an empty implementation and relies on the client to do
120 perm='w', # Best fit choice even if not exactly right (can be d, f or m too)125 # the logging for debugging purposes. Not worth the trouble so far
121 auth_needed=True, arg_needed=True, check_path=False,126 # -- vila 20110607
122 help='Syntax: SITE CHMOD <SP> octal_mode_bits file-name (chmod file)',127 if cmd in ("DELE", "RMD", "RNFR", "RNTO", "MKD"):
123 )128 line = '"%s" %s' % (' '.join([cmd, unicode(arg)]).strip(),
124# An empty password is valid, hence the arg is neither mandatory not forbidden129 respcode)
125ftpserver.proto_cmds['PASS'].arg_needed = None130 self.log(line)
131
132
133if pyftplib_version < (0, 6,0):
134 # pyftpdlib says to define SITE commands by declaring ftp_SITE_<CMD>
135 # methods, but fails to recognize them.
136 ftpserver.proto_cmds['SITE CHMOD'] = ftpserver._CommandProperty(
137 # Best fit choice even if not exactly right (can be d, f or m too)
138 perm='w',
139 auth_needed=True, arg_needed=True, check_path=False,
140 help='Syntax: SITE CHMOD <SP> octal_mode_bits file-name (chmod file)',
141 )
142 # An empty password is valid, hence the arg is neither mandatory not
143 # forbidden
144 ftpserver.proto_cmds['PASS'].arg_needed = None
145else:
146 # Same rationale as above (the password should be optional), but the hole
147 # in pyftplib-0.6.0 is narrower
148 ftpserver.proto_cmds['PASS']['arg'] = None
126149
127150
128class ftp_server(ftpserver.FTPServer):151class ftp_server(ftpserver.FTPServer):
129152
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- doc/en/release-notes/bzr-2.4.txt 2011-06-06 11:13:41 +0000
+++ doc/en/release-notes/bzr-2.4.txt 2011-06-07 08:21:37 +0000
@@ -117,6 +117,11 @@
117* Multiple ``selftest --exclude`` options are now combined instead of117* Multiple ``selftest --exclude`` options are now combined instead of
118 overriding each other. (Vincent Ladeuil, #746991)118 overriding each other. (Vincent Ladeuil, #746991)
119119
120* Restore some ``FTPTransport`` test coverage by allowing ``pyftpdlib
121 0.6.0`` to be used. Also restore ``medusa`` support while leaving it
122 disabled to make it easier to use if/when we can in the future.
123 (Vincent Ladeuil, #781140)
124
120* `TestImportTariffs` no longer uses the real ``$HOME``. This prevents it125* `TestImportTariffs` no longer uses the real ``$HOME``. This prevents it
121 from polluting ``$HOME/.bzr.log`` or being accidentally influenced by126 from polluting ``$HOME/.bzr.log`` or being accidentally influenced by
122 user configuration such as aliases. It still runs with all the user's127 user configuration such as aliases. It still runs with all the user's