[Checkins] SVN: zope.server/trunk/ Merge from 3.4 branch.
Christophe Combelles
ccomb at free.fr
Fri Aug 15 08:26:14 EDT 2008
Log message for revision 89876:
Merge from 3.4 branch.
Fix failures when the ZEO tests are run before by the same testrunner
Changed:
U zope.server/trunk/CHANGES.txt
U zope.server/trunk/src/zope/server/ftp/tests/test_ftpserver.py
U zope.server/trunk/src/zope/server/ftp/tests/test_publisher.py
U zope.server/trunk/src/zope/server/http/tests/test_httpserver.py
U zope.server/trunk/src/zope/server/http/tests/test_wsgiserver.py
-=-
Modified: zope.server/trunk/CHANGES.txt
===================================================================
--- zope.server/trunk/CHANGES.txt 2008-08-15 11:53:34 UTC (rev 89875)
+++ zope.server/trunk/CHANGES.txt 2008-08-15 12:26:13 UTC (rev 89876)
@@ -2,6 +2,12 @@
CHANGES
=======
+3.5.1dev (unreleased)
+---------------------
+
+- Moved some imports from test modules to their setUp to prevent
+ failures when ZEO tests are run by the same testrunner
+
3.5.0 (2008-03-01)
------------------
@@ -12,8 +18,8 @@
- Removed dependency on ZODB.
-3.4.1 and 3.5.0a2 (2007-06-02)
-------------------------------
+3.5.0a2 (2007-06-02)
+--------------------
Made WSGI server really WSGI-compliant by adding variables to the
environment that are required by the spec.
@@ -23,13 +29,12 @@
Added a factory and entry point for PasteDeploy.
-3.4.0 (2007-06-02)
-------------------
+3.4 (2007-04-22)
+----------------
-Removed an unused import. Unchanged otherwise.
+- Initial release as a separate project, corresponds to zope.server
+from Zope 3.4.0a1
-3.4.0a1 (2007-04-22)
---------------------
+- Made WSGI server really WSGI-compliant by adding variables to the
+environment that are required by the spec.
-Initial release as a separate project, corresponds to zope.server
-from Zope 3.4.0a1
Modified: zope.server/trunk/src/zope/server/ftp/tests/test_ftpserver.py
===================================================================
--- zope.server/trunk/src/zope/server/ftp/tests/test_ftpserver.py 2008-08-15 11:53:34 UTC (rev 89875)
+++ zope.server/trunk/src/zope/server/ftp/tests/test_ftpserver.py 2008-08-15 12:26:13 UTC (rev 89876)
@@ -29,7 +29,6 @@
from threading import Thread, Event
from zope.server.adjustments import Adjustments
-from zope.server.ftp.server import FTPServer, status_messages
from zope.server.ftp.tests import demofs
from zope.server.taskthreads import ThreadedTaskDispatcher
from zope.server.tests.asyncerror import AsyncoreErrorHook
@@ -53,6 +52,9 @@
class Tests(unittest.TestCase, AsyncoreErrorHook):
def setUp(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import FTPServer
td.setThreadCount(1)
if len(asyncore.socket_map) != 1:
# Let sockets die off.
@@ -144,6 +146,9 @@
print
def getFTPConnection(self, login=1):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
ftp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ftp.connect((LOCALHOST, self.port))
result = ftp.recv(10000).split()[0]
@@ -177,6 +182,9 @@
def testABOR(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.assertEqual(self.execute('ABOR', 1).rstrip(),
status_messages['TRANSFER_ABORTED'])
@@ -226,6 +234,9 @@
self.testNOOP()
def testCDUP(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.execute('CWD test', 1)
self.assertEqual(self.execute('CDUP', 1).rstrip(),
status_messages['SUCCESS_250'] %'CDUP')
@@ -234,6 +245,9 @@
def testCWD(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.assertEqual(self.execute('CWD test', 1).rstrip(),
status_messages['SUCCESS_250'] %'CWD')
self.assertEqual(self.execute('CWD foo', 1).rstrip(),
@@ -241,6 +255,9 @@
def testDELE(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.assertEqual(self.execute('DELE test/existing', 1).rstrip(),
status_messages['SUCCESS_250'] %'DELE')
res = self.execute('DELE bar', 1).split()[0]
@@ -250,6 +267,9 @@
def testHELP(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
# TODO This test doesn't work. I think it is because execute()
# doesn't read the whole reply. The execeute() helper
# function should be fixed, but that's for another day.
@@ -295,6 +315,9 @@
def testNOOP(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.assertEqual(self.execute('NOOP', 0).rstrip(),
status_messages['SUCCESS_200'] %'NOOP')
self.assertEqual(self.execute('NOOP', 1).rstrip(),
@@ -302,6 +325,9 @@
def testPASS(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.assertEqual(self.execute('PASS', 0).rstrip(),
status_messages['LOGIN_MISMATCH'])
self.execute('USER blah', 0)
@@ -310,6 +336,9 @@
def testQUIT(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.assertEqual(self.execute('QUIT', 0).rstrip(),
status_messages['GOODBYE'])
self.assertEqual(self.execute('QUIT', 1).rstrip(),
@@ -352,6 +381,9 @@
def testUSER(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.server import status_messages
self.assertEqual(self.execute('USER foo', 0).rstrip(),
status_messages['PASS_REQUIRED'])
self.assertEqual(self.execute('USER', 0).rstrip(),
Modified: zope.server/trunk/src/zope/server/ftp/tests/test_publisher.py
===================================================================
--- zope.server/trunk/src/zope/server/ftp/tests/test_publisher.py 2008-08-15 11:53:34 UTC (rev 89875)
+++ zope.server/trunk/src/zope/server/ftp/tests/test_publisher.py 2008-08-15 12:26:13 UTC (rev 89876)
@@ -20,7 +20,6 @@
from fstests import FileSystemTests
from StringIO import StringIO
from zope.publisher.publish import mapply
-from zope.server.ftp.publisher import PublisherFileSystem
class DemoFileSystem(demofs.DemoFileSystem):
@@ -109,6 +108,9 @@
fs.writefile(self.unwritable_filename, StringIO("save this"))
fs.get(self.unwritable_filename).revoke('bob', demofs.write)
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.ftp.publisher import PublisherFileSystem
self.filesystem = PublisherFileSystem('bob', RequestFactory(fs))
def test_suite():
Modified: zope.server/trunk/src/zope/server/http/tests/test_httpserver.py
===================================================================
--- zope.server/trunk/src/zope/server/http/tests/test_httpserver.py 2008-08-15 11:53:34 UTC (rev 89875)
+++ zope.server/trunk/src/zope/server/http/tests/test_httpserver.py 2008-08-15 12:26:13 UTC (rev 89876)
@@ -21,7 +21,6 @@
from threading import Thread, Event
from zope.server.taskthreads import ThreadedTaskDispatcher
-from zope.server.http.httpserver import HTTPServer
from zope.server.adjustments import Adjustments
from zope.server.interfaces import ITask
from zope.server.tests.asyncerror import AsyncoreErrorHook
@@ -45,21 +44,7 @@
my_adj.inbuf_overflow = 10000
-class EchoHTTPServer(HTTPServer):
- def executeRequest(self, task):
- headers = task.request_data.headers
- if 'CONTENT_LENGTH' in headers:
- cl = headers['CONTENT_LENGTH']
- task.response_headers['Content-Length'] = cl
- instream = task.request_data.getBodyStream()
- while 1:
- data = instream.read(8192)
- if not data:
- break
- task.write(data)
-
-
class SleepingTask(object):
implements(ITask)
@@ -77,6 +62,23 @@
class Tests(unittest.TestCase, AsyncoreErrorHook):
def setUp(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.http.httpserver import HTTPServer
+ class EchoHTTPServer(HTTPServer):
+
+ def executeRequest(self, task):
+ headers = task.request_data.headers
+ if 'CONTENT_LENGTH' in headers:
+ cl = headers['CONTENT_LENGTH']
+ task.response_headers['Content-Length'] = cl
+ instream = task.request_data.getBodyStream()
+ while 1:
+ data = instream.read(8192)
+ if not data:
+ break
+ task.write(data)
+
td.setThreadCount(4)
if len(socket_map) != 1:
# Let sockets die off.
Modified: zope.server/trunk/src/zope/server/http/tests/test_wsgiserver.py
===================================================================
--- zope.server/trunk/src/zope/server/http/tests/test_wsgiserver.py 2008-08-15 11:53:34 UTC (rev 89875)
+++ zope.server/trunk/src/zope/server/http/tests/test_wsgiserver.py 2008-08-15 12:26:13 UTC (rev 89876)
@@ -21,7 +21,6 @@
from httplib import HTTPConnection
from zope.server.taskthreads import ThreadedTaskDispatcher
-from zope.server.http.wsgihttpserver import WSGIHTTPServer
from zope.component.testing import PlacelessSetup
import zope.component
@@ -122,6 +121,9 @@
class Tests(PlacelessSetup, unittest.TestCase):
def setUp(self):
+ # import only now to prevent the testrunner from importing it too early
+ # Otherwise dualmodechannel.the_trigger is closed by the ZEO tests
+ from zope.server.http.wsgihttpserver import WSGIHTTPServer
super(Tests, self).setUp()
zope.component.provideAdapter(HTTPCharsets, [IHTTPRequest],
IUserPreferredCharsets, '')
More information about the Checkins
mailing list