[apt-proxy-devel] r658 - trunk/apt_proxy/test

Chris Halls halls at alioth.debian.org
Mon Jun 4 09:55:20 UTC 2007


Author: halls
Date: Mon Jun  4 09:55:20 2007
New Revision: 658

Log:
Change init calls for HangTest classes


Modified:
   trunk/apt_proxy/test/test_requests.py

Modified: trunk/apt_proxy/test/test_requests.py
==============================================================================
--- trunk/apt_proxy/test/test_requests.py	(original)
+++ trunk/apt_proxy/test/test_requests.py	Mon Jun  4 09:55:20 2007
@@ -299,6 +299,16 @@
     backendName = 'test_data'
     packagesTestFile = '/packages/Packages'
 
+    def init(self, config, debugName):
+        """
+        Make a configuration without starting a backend
+        @param debugName Name of class to print in debug messages
+        @param protocol Protocol of fetcher to be tested (http, ftp, rysnc etc)
+        """
+        self.debugname = debugName
+        self.checkDest = True # Used to supress assertion when downloading the same file multiple times
+        TestRequestHelper.setUp(self, config)
+                
     def setUp(self, debugName, protocol, serverFactory, uriSuffix=None):
         """
         Make a configuration with a single backend
@@ -308,20 +318,18 @@
         @param serverFactory Class to provide start() and stop() methods for backend server
         @param uriSuffix This is added to uri requests if necessary
         """
-        self.debugname = debugName
         self.protocol = protocol
         self.server = serverFactory()
         self.uriSuffix = uriSuffix
         self.port = self.server.start()
-        self.checkDest = True # Used to supress assertion when downloading the same file multiple times
 
-        backend_uri = self.protocol + "://127.0.0.1:" + str(self.port)
+        backend_uri = protocol + "://127.0.0.1:" + str(self.port)
         if self.uriSuffix:
             backend_uri += '/' + self.uriSuffix
-        config = ("dynamic_backends=off\nuse_experimental_decompressors=on\n" +
+        config = ("dynamic_backends=off\n" +
                   "[test_data]\n" +
                   "backends=" + str(backend_uri))
-        TestRequestHelper.setUp(self, config)
+        self.init(config, debugName)
         self.testfilesdir = os.path.normpath(os.getcwd()+"/../test_data")
     def tearDown(self):
         log.debug("tearDown", self.debugname)
@@ -722,13 +730,12 @@
 
 class NoConnectionBase(BackendTestBase):
     def setUp(self, protocol):
-        self.debugname = protocol + 'HangTest'
         backend_uri = protocol + "://"+ dead_ip_address
 
         config = ("dynamic_backends=off\n" +
                   "[test_data]\n" +
                   "backends=" + backend_uri)
-        TestRequestHelper.setUp(self, config)
+        BackendTestBase.init(self, config, protocol + 'HangTest')
     def tearDown(self):
         TestRequestHelper.tearDown(self)
     def testConnectionTimeout(self):



More information about the apt-proxy-devel mailing list