Rev 3531: Fix as per Martin's review. in file:///net/bigmamac/Volumes/home/vila/src/bzr/experimental/more-ftp/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Mar 19 14:28:30 GMT 2009


At file:///net/bigmamac/Volumes/home/vila/src/bzr/experimental/more-ftp/

------------------------------------------------------------
revno: 3531
revision-id: v.ladeuil+lp at free.fr-20090319142827-m03usu4my6qvukc8
parent: v.ladeuil+lp at free.fr-20090318182837-bofmu0jpqlctqli7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: pyftpdlib
timestamp: Thu 2009-03-19 15:28:27 +0100
message:
  Fix as per Martin's review.
  
  * bzrlib/transport/ftp/_gssapi.py:
  (get_test_permutations): Replace all occurences of FTPServer by
  FTPTestServer to distinguish between the test front-end and the
  real server.
  
  * bzrlib/transport/ftp/__init__.py:
  (get_test_permutations): Replace all occurences of FTPServer by
  FTPTestServer.
  
  
  * bzrlib/tests/test_ftp_transport.py:
  Replace all occurences of FTPServer by FTPTestServer.
  
  * bzrlib/tests/ftp_server/pyftpdlib_based.py:
  Replace all occurences of FTPServer by FTPTestServer.
  (BzrConformingFTPHandler): Fix odd capitalization.
  
  * bzrlib/tests/ftp_server/medusa_based.py:
  Replace all occurences of FTPServer by FTPTestServer.
  
  * bzrlib/tests/ftp_server/__init__.py:
  (_FTPServerFeature): Update docstring.
  (FTPTestServer): Replace all occurences of FTPServer by
  FTPTestServer.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-03-18 15:38:56 +0000
+++ b/NEWS	2009-03-19 14:28:27 +0000
@@ -113,6 +113,12 @@
       faulty tests were not properly isolated.
       (Andrew Bennetts, Robert Collins)
 
+    * ``medusa`` is not used anymore as an FTP test server starting with
+      python2.6. A new FTP test server based on ``pyftplib`` can be used
+      instead. This new server is a soft dependency as medusa which is still
+      preferred if both are available (modulo python version).  (Vincent
+      Ladeuil)
+
   INTERNALS:
 
     * ``DirState`` can now be passed a custom ``SHA1Provider`` object

=== modified file 'bzrlib/tests/ftp_server/__init__.py'
--- a/bzrlib/tests/ftp_server/__init__.py	2009-03-02 19:54:35 +0000
+++ b/bzrlib/tests/ftp_server/__init__.py	2009-03-19 14:28:27 +0000
@@ -40,8 +40,11 @@
 class _FTPServerFeature(tests.Feature):
     """Some tests want an FTP Server, check if one is available.
 
-    Right now, the only way this is available is if 'medusa' is installed.
-    http://www.amk.ca/python/code/medusa.html
+    Right now, the only way this is available is if one of the following is
+    installed:
+
+    - 'medusa': http://www.amk.ca/python/code/medusa.html
+    - 'pyftpdlib': http://code.google.com/p/pyftpdlib/
     """
 
     def _probe(self):
@@ -77,8 +80,8 @@
 
 
 if medusa_available:
-    FTPServer = medusa_based.FTPServer
+    FTPTestServer = medusa_based.FTPTestServer
 elif pyftpdlib_available:
-    FTPServer = pyftpdlib_based.FTPServer
+    FTPTestServer = pyftpdlib_based.FTPTestServer
 else:
-    FTPServer = UnavailableFTPServer
+    FTPTestServer = UnavailableFTPTestServer

=== modified file 'bzrlib/tests/ftp_server/medusa_based.py'
--- a/bzrlib/tests/ftp_server/medusa_based.py	2009-03-03 15:47:49 +0000
+++ b/bzrlib/tests/ftp_server/medusa_based.py	2009-03-19 14:28:27 +0000
@@ -210,7 +210,7 @@
         trace.mutter('ftp_server %s: %s', type, message)
 
 
-class FTPServer(transport.Server):
+class FTPTestServer(transport.Server):
     """Common code for FTP server facilities."""
 
     def __init__(self):
@@ -250,7 +250,7 @@
         # Don't let it loop forever, or handle an infinite number of requests.
         # In this case it will run for 1000s, or 10000 requests
         self._async_thread = threading.Thread(
-                target=FTPServer._asyncore_loop_ignore_EBADF,
+                target=FTPTestServer._asyncore_loop_ignore_EBADF,
                 kwargs={'timeout':0.1, 'count':10000})
         self._async_thread.setDaemon(True)
         self._async_thread.start()

=== modified file 'bzrlib/tests/ftp_server/pyftpdlib_based.py'
--- a/bzrlib/tests/ftp_server/pyftpdlib_based.py	2009-03-18 16:29:01 +0000
+++ b/bzrlib/tests/ftp_server/pyftpdlib_based.py	2009-03-19 14:28:27 +0000
@@ -59,7 +59,7 @@
         return osutils.safe_utf8(p)
 
 
-class BZRConformingFTPHandler(ftpserver.FTPHandler):
+class BzrConformingFTPHandler(ftpserver.FTPHandler):
 
     abstracted_fs = BzrConformingFS
 
@@ -132,7 +132,7 @@
         self.addr = self.socket.getsockname()
 
 
-class FTPServer(transport.Server):
+class FTPTestServer(transport.Server):
     """Common code for FTP server facilities."""
 
     def __init__(self):
@@ -167,7 +167,7 @@
         address = ('localhost', 0) # bind to a random port
         authorizer = AnonymousWithWriteAccessAuthorizer()
         authorizer.add_anonymous(self._root, perm='elradfmw')
-        self._ftp_server = ftp_server(address, BZRConformingFTPHandler,
+        self._ftp_server = ftp_server(address, BzrConformingFTPHandler,
                                       authorizer)
         # This is hacky as hell, will not work if we need two servers working
         # at the same time, but that's the best we can do so far...

=== modified file 'bzrlib/tests/test_ftp_transport.py'
--- a/bzrlib/tests/test_ftp_transport.py	2009-03-17 08:50:17 +0000
+++ b/bzrlib/tests/test_ftp_transport.py	2009-03-19 14:28:27 +0000
@@ -32,7 +32,7 @@
     _test_needs_features = [ftp_server.FTPServerFeature]
 
     def setUp(self):
-        self.transport_server = ftp_server.FTPServer
+        self.transport_server = ftp_server.FTPTestServer
         super(TestCaseWithFTPServer, self).setUp()
 
 
@@ -48,7 +48,7 @@
         self.assertEqual('aftp://host/path', t.abspath(''))
 
 
-class TestFTPServer(TestCaseWithFTPServer):
+class TestFTPTestServer(TestCaseWithFTPServer):
 
     def test_basic_exists(self):
         url = self.get_url()
@@ -67,17 +67,17 @@
         self.assertEqual('test more bytes\n', t.get_bytes('foo'))
 
 
-class TestFTPServerUI(TestCaseWithFTPServer):
+class TestFTPTestServerUI(TestCaseWithFTPServer):
 
     def setUp(self):
-        super(TestFTPServerUI, self).setUp()
+        super(TestFTPTestServerUI, self).setUp()
         self.user = 'joe'
         self.password = 'secret'
         self.get_server().add_user(self.user, self.password)
 
     def get_url(self, relpath=None):
         """Overrides get_url to inject our user."""
-        base = super(TestFTPServerUI, self).get_url(relpath)
+        base = super(TestFTPTestServerUI, self).get_url(relpath)
         (scheme, user, password,
          host, port, path) = transport.ConnectedTransport._split_url(base)
         url = transport.ConnectedTransport._unsplit_url(

=== modified file 'bzrlib/transport/ftp/__init__.py'
--- a/bzrlib/transport/ftp/__init__.py	2009-03-17 08:15:45 +0000
+++ b/bzrlib/transport/ftp/__init__.py	2009-03-19 14:28:27 +0000
@@ -598,4 +598,4 @@
 def get_test_permutations():
     """Return the permutations to be used in testing."""
     from bzrlib.tests import ftp_server
-    return [(FtpTransport, ftp_server.FTPServer)]
+    return [(FtpTransport, ftp_server.FTPTestServer)]

=== modified file 'bzrlib/transport/ftp/_gssapi.py'
--- a/bzrlib/transport/ftp/_gssapi.py	2009-01-17 01:30:58 +0000
+++ b/bzrlib/transport/ftp/_gssapi.py	2009-03-19 14:28:27 +0000
@@ -153,6 +153,6 @@
     from bzrlib import tests
     if tests.FTPServerFeature.available():
         from bzrlib.tests import ftp_server
-        return [(GSSAPIFtpTransport, ftp_server.FTPServer)]
+        return [(GSSAPIFtpTransport, ftp_server.FTPTestServer)]
     else:
         return []



More information about the bazaar-commits mailing list