Rev 5019: Move DecoratorServer to test_server.py in file:///home/vila/src/bzr/cleanup/test-servers/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Feb 9 17:06:49 GMT 2010


At file:///home/vila/src/bzr/cleanup/test-servers/

------------------------------------------------------------
revno: 5019
revision-id: v.ladeuil+lp at free.fr-20100209170649-ae9ore5pp4durhdg
parent: v.ladeuil+lp at free.fr-20100209164030-oa6bos3m5fshecp0
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: test-servers
timestamp: Tue 2010-02-09 18:06:49 +0100
message:
  Move DecoratorServer to test_server.py
-------------- next part --------------
=== modified file 'bzrlib/tests/test_server.py'
--- a/bzrlib/tests/test_server.py	2010-02-09 16:40:30 +0000
+++ b/bzrlib/tests/test_server.py	2010-02-09 17:06:49 +0000
@@ -53,3 +53,46 @@
         raise NotImplementedError
 
 
+class DecoratorServer(Server):
+    """Server for the TransportDecorator for testing with.
+
+    To use this when subclassing TransportDecorator, override override the
+    get_decorator_class method.
+    """
+
+    def start_server(self, server=None):
+        """See bzrlib.transport.Server.start_server.
+
+        :server: decorate the urls given by server. If not provided a
+        LocalServer is created.
+        """
+        if server is not None:
+            self._made_server = False
+            self._server = server
+        else:
+            from bzrlib.transport.local import LocalURLServer
+            self._made_server = True
+            self._server = LocalURLServer()
+            self._server.start_server()
+
+    def stop_server(self):
+        if self._made_server:
+            self._server.stop_server()
+
+    def get_decorator_class(self):
+        """Return the class of the decorators we should be constructing."""
+        raise NotImplementedError(self.get_decorator_class)
+
+    def get_url_prefix(self):
+        """What URL prefix does this decorator produce?"""
+        return self.get_decorator_class()._get_url_prefix()
+
+    def get_bogus_url(self):
+        """See bzrlib.transport.Server.get_bogus_url."""
+        return self.get_url_prefix() + self._server.get_bogus_url()
+
+    def get_url(self):
+        """See bzrlib.transport.Server.get_url."""
+        return self.get_url_prefix() + self._server.get_url()
+
+

=== modified file 'bzrlib/transport/decorator.py'
--- a/bzrlib/transport/decorator.py	2010-01-07 03:03:01 +0000
+++ b/bzrlib/transport/decorator.py	2010-02-09 17:06:49 +0000
@@ -177,49 +177,6 @@
             return None
 
 
-class DecoratorServer(Server):
-    """Server for the TransportDecorator for testing with.
-
-    To use this when subclassing TransportDecorator, override override the
-    get_decorator_class method.
-    """
-
-    def start_server(self, server=None):
-        """See bzrlib.transport.Server.start_server.
-
-        :server: decorate the urls given by server. If not provided a
-        LocalServer is created.
-        """
-        if server is not None:
-            self._made_server = False
-            self._server = server
-        else:
-            from bzrlib.transport.local import LocalURLServer
-            self._made_server = True
-            self._server = LocalURLServer()
-            self._server.start_server()
-
-    def stop_server(self):
-        if self._made_server:
-            self._server.stop_server()
-
-    def get_decorator_class(self):
-        """Return the class of the decorators we should be constructing."""
-        raise NotImplementedError(self.get_decorator_class)
-
-    def get_url_prefix(self):
-        """What URL prefix does this decorator produce?"""
-        return self.get_decorator_class()._get_url_prefix()
-
-    def get_bogus_url(self):
-        """See bzrlib.transport.Server.get_bogus_url."""
-        return self.get_url_prefix() + self._server.get_bogus_url()
-
-    def get_url(self):
-        """See bzrlib.transport.Server.get_url."""
-        return self.get_url_prefix() + self._server.get_url()
-
-
 def get_test_permutations():
     """Return the permutations to be used in testing.
 



More information about the bazaar-commits mailing list