[Zope3-checkins] SVN: Zope3/branches/mkerrin-twisted-upgrade/src/ Nearly use the twisted trunk and not some older version of it.

Michael Kerrin michael.kerrin at openapp.biz
Thu Nov 2 14:58:01 EST 2006


Log message for revision 71035:
  Nearly use the twisted trunk and not some older version of it.
  

Changed:
  _U  Zope3/branches/mkerrin-twisted-upgrade/src/
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trial.txt
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtest.py
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestfs.py
  U   Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestft.py

-=-

Property changes on: Zope3/branches/mkerrin-twisted-upgrade/src
___________________________________________________________________
Name: svn:externals
   - docutils       svn://svn.zope.org/repos/main/docutils/tags/0.4.0
ZConfig        svn://svn.zope.org/repos/main/ZConfig/trunk/ZConfig
BTrees         -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees
persistent     -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent
ThreadedAsync  -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync
transaction    -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction
ZEO            -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO
ZODB           -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB
twisted        -r 15340 svn://svn.twistedmatrix.com/svn/Twisted/trunk/twisted
zdaemon        -r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon

   + docutils       svn://svn.zope.org/repos/main/docutils/tags/0.4.0
ZConfig        svn://svn.zope.org/repos/main/ZConfig/trunk/ZConfig
BTrees         -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees
persistent     -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent
ThreadedAsync  -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync
transaction    -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction
ZEO            -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO
ZODB           -r 69562 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB
twisted        svn://svn.twistedmatrix.com/svn/Twisted/trunk/twisted
zdaemon        -r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon


Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py	2006-11-02 19:43:35 UTC (rev 71034)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zope_ftp.py	2006-11-02 19:58:00 UTC (rev 71035)
@@ -32,12 +32,6 @@
 from twisted.trial.util import wait
 from twisted.trial.unittest import TestCase
 
-## Install monkey patches in the test_zopetrail module that
-## allow me to cleanly test the Twisted server code from within
-## the Zope test runner.
-import test_zopetrial
-
-
 class DemoFileSystem(demofs.DemoFileSystem):
     def mkdir_nocheck(self, path):
         path, name = posixpath.split(path)
@@ -69,6 +63,7 @@
     def tearDown(self):
         ## Uninstall the monkey patches needed to get the tiral tests
         ## running successfully within the zope test runner.
+        import test_zopetrial
         test_zopetrial.killthreads()
 
         # Clean up sockets
@@ -412,8 +407,6 @@
 
 
 def test_suite():
-    test_zopetrial.patchtrial()
-
     suite = unittest.TestSuite()
 
     suite.addTest(unittest.makeSuite(FTPServerTestCase))

Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py	2006-11-02 19:43:35 UTC (rev 71034)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/test_zopetrial.py	2006-11-02 19:58:00 UTC (rev 71035)
@@ -11,7 +11,8 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Contains helper functions and monkey patch to integrate twisted trial
+"""
+Contains helper functions and monkey patch to integrate twisted trial
 tests with the Zope testrunner.
 
 This code will be unneeded when Twisted 2.3 comes out has it contains
@@ -26,132 +27,17 @@
 
 import unittest
 from zope.testing import doctest
-import sets
-import time
 import sys
-import os
+import os.path
 import gc
 import re
 
-import twisted.python.failure
-import twisted.trial.unittest
-import twisted.trial.reporter
-import twisted.trial.util
 import zope.testing.testrunner
 
-class UnsupportedTrialFeature(Exception):
-    """A feature of twisted.trial was used that pyunit cannot support."""
 
-
-class PyUnitResultAdapter(object):
-    def __init__(self, original):
-        self.original = original
-
-    def _exc_info(self, err):
-        from twisted.trial import reporter
-        if isinstance(err, twisted.python.failure.Failure):
-            # Unwrap the Failure into a exc_info tuple.
-            # XXX: if err.tb is a real traceback and not stringified, we should
-            #      use that.
-            err = (err.type, err.value, None)
-        return err
-
-    def startTest(self, method):
-        self.original.startTest(method)
-
-    def stopTest(self, method):
-        self.original.stopTest(method)
-
-    def addFailure(self, test, fail):
-        if self.original.options.verbose > 2:
-            print " (%.3f ms)" % (time.time() - self.original._start_time)
-
-        self.original.failures.append((test, fail.getTraceback()))
-        print
-        print "Failure in test %s" % test
-        print fail.getTraceback()
-
-        if self.original.options.post_mortem:
-            zope.testing.testrunner.post_mortem(exc_info)
-
-        self.original.test_width = self.original.last_width = 0
-
-    def addError(self, test, error):
-        if self.original.options.verbose > 2:
-            print " (%.3f ms)" % (time.time() - self.original._start_time)
-
-        self.original.errors.append((test, error.getTraceback()))
-        print
-        print "Error in test %s" % test
-        print error.getTraceback()
-
-        if self.original.options.post_mortem:
-            if self.original.options.resume_layer:
-                print
-                print '*'*70
-                print ("Can't post-mortem debug when running a layer"
-                       " as a subprocess!")
-                print '*'*70
-                print
-            else:
-                zope.testing.testrunner.post_mortem(exc_info)
-
-        self.original.test_width = self.original.last_width = 0
-
-    def _unsupported(self, test, feature, info):
-        self.original.addFailure(
-            test, 
-            (UnsupportedTrialFeature, 
-             UnsupportedTrialFeature(feature, info), 
-             None))
-
-    def addSkip(self, test, reason):
-        self._unsupported(test, 'skip', reason)
-
-    def addUnexpectedSuccess(self, test, todo):
-        self._unsupported(test, 'unexpected success', todo)
-        
-    def addExpectedFailure(self, test, error):
-        self._unsupported(test, 'expected failure', error)
-
-    def addSuccess(self, test):
-        self.original.addSuccess(test)
-
-    def upDownError(self, method, warn = True, printStatus = True):
-        pass
-
-    def cleanupErrors(self, errs):
-        pass
-    
-    def startSuite(self, name):
-        pass
-
-
-orig_run = twisted.trial.unittest.TestCase.run
-
-def new_run(self, result):
-    if not isinstance(result, twisted.trial.reporter.Reporter):
-        result = PyUnitResultAdapter(result)
-    orig_run(self, result)
-    try:
-        twisted.trial.util._Janitor().postCaseCleanup()
-    except:
-        result.cleanupErrors(twisted.python.failure.Failure(sys.exc_info()))
-
-def patchtrial():
-    #
-    # Patch the twisted.trial.unittest.TestCase class inorder for it to run
-    # within the Zope testrunner. Only patch this class if we need to. Newer
-    # versions of Twisted don't need to be patched.
-    #
-    try:
-        twisted.trial.unittest.PyUnitResultAdapter
-    except AttributeError:
-        ## old version of twisted we need to patch twisted.
-        twisted.trial.unittest.TestCase.run = new_run
-
 def killthreads():
-    """A lot of tests will start threads which the Zope testrunner complains
+    """
+    A lot of tests will start threads which the Zope testrunner complains
     about. You can use this method to kill off these threads.
     """
     from twisted.internet import reactor, interfaces
@@ -195,9 +81,6 @@
     sys.modules.update(test.globs['saved-sys-info'][2])
 
 def test_suite():
-    # patch trial before starting so that our test fail when they should.
-    patchtrial()
-
     # copied from zope.testing.testrunner
     import zope.testing.renormalizing
     checker = zope.testing.renormalizing.RENormalizing([

Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trial.txt
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trial.txt	2006-11-02 19:43:35 UTC (rev 71034)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trial.txt	2006-11-02 19:58:00 UTC (rev 71035)
@@ -27,25 +27,12 @@
     Running unit tests:
     <BLANKLINE>
     Error in test test_error (trialtest.TestTrialTests)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", Line NNN, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtest.py", Line NNN, in test_error
-        raise Exception, "this test is a broken trial test :-)"
-    exceptions.Exception: this test is a broken trial test :-)
+    Exception: this test is a broken trial test :-)
     <BLANKLINE>
     <BLANKLINE>
+    <BLANKLINE>
     Failure in test test_failure (trialtest.TestTrialTests)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", Line NNN, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtest.py", Line NNN, in test_failure
-        self.assert_(False, "I am a failed trial test")
-    twisted.trial.unittest.FailTest: I am a failed trial test
+    FailTest: I am a failed trial test
     <BLANKLINE>
       Ran 3 tests with 1 failures and 1 errors in N.NNN seconds.
     True
@@ -59,36 +46,15 @@
     Running unit tests:
     <BLANKLINE>
     Error in test test_assert_ok (trialtestfs.TestTrialBrokenSetup)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestfs.py", line 28, in setUp
-        raise Exception, 'broken setup'
-    exceptions.Exception: broken setup
+    Exception: broken setup
     <BLANKLINE>
     <BLANKLINE>
     Error in test test_error (trialtestfs.TestTrialBrokenSetup)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestfs.py", line 28, in setUp
-        raise Exception, 'broken setup'
-    exceptions.Exception: broken setup
+    Exception: broken setup
     <BLANKLINE>
     <BLANKLINE>
     Error in test test_failure (trialtestfs.TestTrialBrokenSetup)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestfs.py", line 28, in setUp
-        raise Exception, 'broken setup'
-    exceptions.Exception: broken setup
+    Exception: broken setup
     <BLANKLINE>
       Ran 3 tests with 0 failures and 3 errors in N.NNN seconds.
     True
@@ -102,60 +68,23 @@
     Running unit tests:
     <BLANKLINE>
     Error in test test_assert_ok (trialtestft.TestTrialBrokenTeardown)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestft.py", line 30, in tearDown
-        raise Exception, 'broken tearDown'
-    exceptions.Exception: broken tearDown
+    Exception: broken tearDown
     <BLANKLINE>
     <BLANKLINE>
     Error in test test_error (trialtestft.TestTrialBrokenTeardown)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestft.py", line 33, in test_error
-        raise Exception, "this test is a broken trial test :-)"
-    exceptions.Exception: this test is a broken trial test :-)
+    Exception: this test is a broken trial test :-)
     <BLANKLINE>
     <BLANKLINE>
     Error in test test_error (trialtestft.TestTrialBrokenTeardown)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestft.py", line 30, in tearDown
-        raise Exception, 'broken tearDown'
-    exceptions.Exception: broken tearDown
+    Exception: broken tearDown
     <BLANKLINE>
     <BLANKLINE>
     Failure in test test_failure (trialtestft.TestTrialBrokenTeardown)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestft.py", line 36, in test_failure
-        self.assert_(False, "I am a failed trial test")
-      File "...twisted/trial/unittest.py", line 223, in failUnless
-        raise self.failureException(msg)
-    twisted.trial.unittest.FailTest: I am a failed trial test
+    FailTest: I am a failed trial test
     <BLANKLINE>
     <BLANKLINE>
     Error in test test_failure (trialtestft.TestTrialBrokenTeardown)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", line 107, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtestft.py", line 30, in tearDown
-        raise Exception, 'broken tearDown'
-    exceptions.Exception: broken tearDown
+    Exception: broken tearDown
     <BLANKLINE>
       Ran 3 tests with 1 failures and 4 errors in 0.118 seconds.
     True
@@ -166,7 +95,7 @@
     >>> import twisted.trial.util
     >>> old_doCleanReactor = twisted.trial.util._Janitor.do_cleanReactor
     >>> def new_doCleanReactor(cls):
-    ...     raise Exception, "Can't clean the reactor"
+    ...     raise Exception("Can't clean the reactor")
     ...
     >>> twisted.trial.util._Janitor.do_cleanReactor = new_doCleanReactor
 
@@ -176,25 +105,11 @@
     Running unit tests:
     <BLANKLINE>
     Error in test test_error (trialtest.TestTrialTests)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", Line NNN, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtest.py", Line NNN, in test_error
-        raise Exception, "this test is a broken trial test :-)"
-    exceptions.Exception: this test is a broken trial test :-)
+    Exception: this test is a broken trial test :-)
     <BLANKLINE>
     <BLANKLINE>
     Failure in test test_failure (trialtest.TestTrialTests)
-    Traceback (most recent call last):
-    ...
-    --- <exception caught here> ---
-      File "...twisted/internet/defer.py", Line NNN, in maybeDeferred
-        result = f(*args, **kw)
-      File "...app/twisted/ftp/tests/trialtest.py", Line NNN, in test_failure
-        self.assert_(False, "I am a failed trial test")
-    twisted.trial.unittest.FailTest: I am a failed trial test
+    FailTest: I am a failed trial test
     <BLANKLINE>
       Ran 3 tests with 1 failures and 1 errors in N.NNN seconds.
     True

Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtest.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtest.py	2006-11-02 19:43:35 UTC (rev 71034)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtest.py	2006-11-02 19:58:00 UTC (rev 71035)
@@ -33,7 +33,7 @@
         pass
 
     def test_error(self):
-        raise Exception, "this test is a broken trial test :-)"
+        raise Exception("this test is a broken trial test :-)")
 
     def test_failure(self):
         self.assert_(False, "I am a failed trial test")

Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestfs.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestfs.py	2006-11-02 19:43:35 UTC (rev 71034)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestfs.py	2006-11-02 19:58:00 UTC (rev 71035)
@@ -23,13 +23,13 @@
 class TestTrialBrokenSetup(twisted.trial.unittest.TestCase):
 
     def setUp(self):
-        raise Exception, 'broken setup'
+        raise Exception("broken setup")
 
     def tearDown(self):
         pass
 
     def test_error(self):
-        raise Exception, "this test is a broken trial test :-)"
+        raise Exception("this test is a broken trial test :-)")
 
     def test_failure(self):
         self.assert_(False, "I am a failed trial test")

Modified: Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestft.py
===================================================================
--- Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestft.py	2006-11-02 19:43:35 UTC (rev 71034)
+++ Zope3/branches/mkerrin-twisted-upgrade/src/zope/app/twisted/ftp/tests/trialtestft.py	2006-11-02 19:58:00 UTC (rev 71035)
@@ -26,10 +26,10 @@
         pass
 
     def tearDown(self):
-        raise Exception, 'broken tearDown'
+        raise Exception("broken tearDown")
 
     def test_error(self):
-        raise Exception, "this test is a broken trial test :-)"
+        raise Exception("this test is a broken trial test :-)")
 
     def test_failure(self):
         self.assert_(False, "I am a failed trial test")



More information about the Zope3-Checkins mailing list