[Zope3-checkins] SVN: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/t Finally got all the FTP trial tests to run within the

Michael Kerrin michael.kerrin at openapp.biz
Mon Apr 3 13:49:47 EDT 2006


Log message for revision 66355:
  Finally got all the FTP trial tests to run within the
  Zope testrunner.
  

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

-=-
Modified: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/test_zope_ftp.py
===================================================================
--- Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/test_zope_ftp.py	2006-04-03 16:48:29 UTC (rev 66354)
+++ Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/test_zope_ftp.py	2006-04-03 17:49:47 UTC (rev 66355)
@@ -32,8 +32,12 @@
 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)
@@ -65,23 +69,19 @@
     def tearDown(self):
         ## Uninstall the monkey patches needed to get the tiral tests
         ## running successfully within the zope test runner.
-        test_zopetrial.tearDown()
+        test_zopetrial.killthreads()
 
         # Clean up sockets
         self.client.transport.loseConnection()
-        d = self.port.stopListening()
-        if d is not None:
-            wait(d)
+        d = defer.maybeDeferred(self.port.stopListening)
+        d.addCallback(self.ebCallback)
 
+        return d
+
+    def ebCallback(self, ignore):
         del self.serverProtocol
 
     def setUp(self):
-        ## Install monkey patches in the test_zopetrail module that
-        ## allow me to cleanly test the Twisted server code from within
-        ## the Zope test runner.
-        ## Don't forget to call test_zopetrial.tearDown
-        test_zopetrial.setUp()
-
         root = demofs.Directory()
         # the tuple has a user name is used by ZopeSimpleAuthentication to
         # authenticate users.
@@ -310,6 +310,9 @@
         self.assertEqual(['550 /foo: No such file or directory.'],
                          responseLines)
 
+        d = downloader.transport.loseConnection()
+        return d
+
     def testManyLargeDownloads(self):
         # Login
         self._anonymousLogin()
@@ -409,6 +412,8 @@
 
 
 def test_suite():
+    test_zopetrial.patchtrial()
+
     suite = unittest.TestSuite()
 
     suite.addTest(unittest.makeSuite(FTPServerTestCase))

Modified: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/test_zopetrial.py
===================================================================
--- Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/test_zopetrial.py	2006-04-03 16:48:29 UTC (rev 66354)
+++ Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/test_zopetrial.py	2006-04-03 17:49:47 UTC (rev 66355)
@@ -11,20 +11,13 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Contains helper functions and monkey patches to integrate twisted trial
-tests with the zope testrunner.
+"""Contains helper functions and monkey patch to integrate twisted trial
+tests with the Zope testrunner.
 
-WARNING - use with care - actaully just DO NOT USE THIS CODE. I only wrote
-his to test the ftp server and the only the ftp server. It should NOT be used
-for anything else. If we need to integrate the twisted trial framework and the
-zope.testing testrunner for anything else we need to think about this and come
-up with something better. Seriously.
+This code will be unneeded when Twisted 2.3 comes out has it contains
+code to integrate itself with any pyunit system. But we it need it now to
+integrate the test_zope_ftp tests with the zope.testing test runner.
 
-Twisted wraps all failures inside twisted.python.failure.Failure objects, and
-it also catches every exception thrown so I need this code to make my tests
-fail when they are broken. Otherwise they will always pass with the exception
-of syntax errors.
-
 Michael Kerrin <michael.kerrin at openapp.biz>
 
 $Id$
@@ -32,41 +25,68 @@
 __docformat__="restructuredtext"
 
 import unittest
+import doctest
+import sets
+import time
+import sys
+import os
+import gc
+import re
 
+import twisted.python.failure
 import twisted.trial.unittest
-from twisted.python.failure import Failure
-
+import twisted.trial.reporter
+import twisted.trial.util
 import zope.testing.testrunner
-from zope.testing.testrunner import TestResult
 
-from twisted.trial import util
+class UnsupportedTrialFeature(Exception):
+    """A feature of twisted.trial was used that pyunit cannot support."""
 
-old_addError = zope.testing.testrunner.TestResult.addError
-old_addFailure = zope.testing.testrunner.TestResult.addFailure
 
-RUNNING_TESTS = False
+class PyUnitResultAdapter(object):
+    def __init__(self, original):
+        self.original = original
 
-def print_traceback(msg, exc_info):
-    print
-    print msg
+    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
 
-    tb = "".join(exc_info.getTraceback())
+    def startTest(self, method):
+        self.original.startTest(method)
 
-    print tb
+    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)
 
-def new_addError(self, test, exc_info):
-    if isinstance(exc_info, Failure):
-        if self.options.verbose > 2:
-            print " (%.3f ms)" % (time.time() - self._start_time)
-        self.errors.append((test, exc_info.getTraceback()))
+        self.original.failures.append((test, fail.getTraceback()))
+        print
+        print "Failure in test %s" % test
+        print fail.getTraceback()
 
-        if not RUNNING_TESTS:
-            print
-            print_traceback("Error in test %s" % test, exc_info)
+        if self.original.options.post_mortem:
+            zope.testing.testrunner.post_mortem(exc_info)
 
-        if self.options.post_mortem:
-            if self.options.resume_layer:
+        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"
@@ -76,153 +96,142 @@
             else:
                 zope.testing.testrunner.post_mortem(exc_info)
 
-        self.test_width = self.last_width = 0
-    else:
-        old_addError(self, test, 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 new_addFailure(self, test, exc_info):
-    if isinstance(exc_info, Failure):
-        if self.options.verbose > 2:
-            print " (%.3f ms)" % (time.time() - self._start_time)
+    def addSkip(self, test, reason):
+        self._unsupported(test, 'skip', reason)
 
-        self.failures.append((test, exc_info.getTraceback()))
+    def addUnexpectedSuccess(self, test, todo):
+        self._unsupported(test, 'unexpected success', todo)
+        
+    def addExpectedFailure(self, test, error):
+        self._unsupported(test, 'expected failure', error)
 
-        if not RUNNING_TESTS:
-            print
-            print_traceback("Failure in test %s" % test, exc_info)
+    def addSuccess(self, test):
+        self.original.addSuccess(test)
 
-        if self.options.post_mortem:
-            zope.testing.testrunner.post_mortem(exc_info)
+    def upDownError(self, method, warn = True, printStatus = True):
+        pass
 
-        self.test_width = self.last_width = 0
-    else:
-        old_addFailure(self, test, exc_info)
+    def cleanupErrors(self, errs):
+        pass
+    
+    def startSuite(self, name):
+        pass
 
 
-def setUp():
-    # IMPORTANT - call the tearDown method below if you use this method!!!
-    #
+orig_run = twisted.trial.unittest.TestCase.run
 
-    # Monkey-patch the twisted.trial so has to catch and handle
-    # twisted.python.failure.Failure object correctly.
-    zope.testing.testrunner.TestResult.addError = new_addError
-    zope.testing.testrunner.TestResult.addFailure = new_addFailure
+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 twisted.trial.util.FailureError, e:
+        for failure in e.failures:
+            result.cleanupErrors(failure)
+    except:
+        result.cleanupErrors(twisted.python.failure.Failure(sys.exc_info()))
 
-def tearDown():
-    # IMPORTANT - call this method!!!!!!!!!!!!!!!!!!!!!!!!!!!
+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
 
-    # Un-Monkey-patch the twisted.trial so has to catch and handle
-    # twisted.python.failure.Failure object correctly.
-    zope.testing.testrunner.TestResult.addError = new_addError
-    zope.testing.testrunner.TestResult.addFailure = new_addFailure
+def killthreads():
+    """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
+    from twisted.python import threadpool
+    if interfaces.IReactorThreads.providedBy(reactor):
+        reactor.suggestThreadPoolSize(0)
+        if reactor.threadpool:
+            reactor.threadpool.stop()
+            reactor.threadpool = None
+            reactor.threadpool = threadpool.ThreadPool(0, 10)
+            reactor.threadpool.start()
 
-    # Something funny happens with threads, the twisted reactor and zope.
-    # This fixes it.
-    util._Janitor.do_cleanThreads()
+orig_configure_logging = zope.testing.testrunner.configure_logging
 
-#
-# Now just make sure that all this does what it says.
-#
+def setUp(test):
+    # This setup is for testing the trial integration. This test indirectly
+    # call the zope.testing.testrunner.configure_logging method which tries
+    # to reconfigure the logging. This causes problems with some of the other
+    # tests. Nullify this method now, this should OK since the logging should
+    # all be set up at this stage.
+    zope.testing.testrunner.configure_logging = lambda : None
 
-class TestZopeTests(unittest.TestCase):
+    test.globs['this_directory'] = os.path.split(__file__)[0]
+    test.globs['saved-sys-info'] = (
+        sys.path[:],
+        sys.argv[:],
+        sys.modules.copy(),
+        gc.get_threshold(),
+        )
+    test.globs['testrunner_script'] = __file__
 
-    def setUp(self):
-        setUp()
 
-    def tearDown(self):
-        tearDown()
+def tearDown(test):
+    # redefine the configure_logging method that we nullified in the setUp
+    # for these tests.
+    zope.testing.testrunner.configure_logging = orig_configure_logging
 
-    def test_error(self):
-        raise Exception, "this test is a broken zope test :-)"
+    sys.path[:], sys.argv[:] = test.globs['saved-sys-info'][:2]
+    gc.set_threshold(*test.globs['saved-sys-info'][3])
+    sys.modules.clear()
+    sys.modules.update(test.globs['saved-sys-info'][2])
 
-    def test_failure(self):
-        self.assert_(False, "I am a failed zope test")
+def test_suite():
+    # patch trial before starting so that our test fail when they should.
+    patchtrial()
 
-    def test_assert_ok(self):
-        self.assert_(True, "I am a good test")
+    # copied from zope.testing.testrunner
+    import zope.testing.renormalizing
+    checker = zope.testing.renormalizing.RENormalizing([
+        (re.compile('^> [^\n]+->None$', re.M), '> ...->None'),
+        (re.compile('\\\\'), '/'),   # hopefully, we'll make windows happy
+        (re.compile('/r'), '\\\\r'), # undo damage from previous
+        (re.compile(r'\r'), '\\\\r\n'),
+        (re.compile(r'\d+[.]\d\d\d seconds'), 'N.NNN seconds'),
+        (re.compile(r'\d+[.]\d\d\d ms'), 'N.NNN ms'),
+        (re.compile('( |")[^\n]+testrunner-ex'), r'\1testrunner-ex'),
+        (re.compile('( |")[^\n]+testrunner.py'), r'\1testrunner.py'),
+        (re.compile(r'> [^\n]*(doc|unit)test[.]py\(\d+\)'),
+         r'\1doctest.py(NNN)'),
+        (re.compile(r'[.]py\(\d+\)'), r'.py(NNN)'),
+        (re.compile(r'[.]py:\d+'), r'.py:NNN'),
+        (re.compile(r' line \d+,', re.IGNORECASE), r' Line NNN,'),
 
+        # omit traceback entries for unittest.py or doctest.py from
+        # output:
+        (re.compile(r'^ +File "[^\n]+(doc|unit)test.py", [^\n]+\n[^\n]+\n',
+                    re.MULTILINE),
+         r''),
+        (re.compile('^> [^\n]+->None$', re.M), '> ...->None'),
+        (re.compile('import pdb; pdb'), 'Pdb()'), # Py 2.3
+        ])
+    
+    suites = [
+        doctest.DocFileSuite('trial.txt',
+                             setUp = setUp, tearDown = tearDown,
+                             optionflags = doctest.ELLIPSIS,
+                             checker = checker),
+        ]
 
-class TestTrialTests(twisted.trial.unittest.TestCase):
-
-    def setUp(self):
-        setUp()
-
-    def tearDown(self):
-        tearDown()
-
-    def test_error(self):
-        raise Exception, "this test is a broken trial test :-)"
-
-    def test_failure(self):
-        self.assert_(False, "I am a failed trial test")
-
-    def test_assert_ok(self):
-        self.assert_(True, "I am a good test")
-
-
-class Options(object):
-    # simple object to simpilutate the minium zope.testing options.
-    progress = False
-    verbose  = 0
-    post_mortem = None
-
-
-old_print_traceback = zope.testing.testrunner.print_traceback
-def new_print_traceback(msg, exc_info):
-    # don't print out anything when running the test tests.
-    pass
-
-
-class TestTrialIntegration(unittest.TestCase):
-
-    def run_test(self, name, tests):
-        global RUNNING_TESTS
-
-        RUNNING_TESTS = True
-        zope.testing.testrunner.print_traceback = new_print_traceback
-
-        result = zope.testing.testrunner.TestResult(Options(), tests)
-        for test in tests:
-            test(result)
-
-        RUNNING_TESTS = False
-        zope.testing.testrunner.print_traceback = old_print_traceback
-
-        return result
-
-    def test_trial_tests(self):
-        suite = unittest.makeSuite(TestTrialTests)
-        result = self.run_test('', suite)
-        self._assertResults(
-            'zope.app.twisted.ftp.tests.test_zopetrial.TestTrialTests', result)
-
-    def test_zope_tests(self):
-        suite = unittest.makeSuite(TestZopeTests)
-        result = self.run_test('', suite)
-        self._assertResults(
-            'zope.app.twisted.ftp.tests.test_zopetrial.TestZopeTests', result)
-
-    def _assertResults(self, basetest, result):
-        # errors
-        self.assertEqual(len(result.failures), 1)
-        self.assertEqual(result.failures[0][0].id(),
-                         '%s.test_failure' % basetest)
-
-        # failures
-        self.assertEqual(len(result.errors), 1)
-        self.assertEqual(result.errors[0][0].id(), '%s.test_error' % basetest)
-
-        # ok
-        self.assertEqual(result.testsRun, 3) # ok, error, failure
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(TestTrialIntegration))
-
-    return suite
-
-if __name__ == '__main__':
-    test_suite()
+    return unittest.TestSuite(suites)

Added: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trial.txt
===================================================================
--- Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trial.txt	2006-04-03 16:48:29 UTC (rev 66354)
+++ Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trial.txt	2006-04-03 17:49:47 UTC (rev 66355)
@@ -0,0 +1,161 @@
+Running trial tests within Twisted
+==================================
+
+Trial tests are used to test in some circumstances the integration between
+Zope and Twisted. The standard Zope test suites don't work since a lot of the
+methods we are testing require use to return deferred objects. These deferred
+objects contain callbacks and error callbacks which we need to test.
+
+In order to set up the test suite correctly in order to test the deferreds
+we need our test suite to extend the twisted.trial.unittest.TestCase object.
+Then our setup methods must call the zope.testing.trial.setUp method and our
+teardown method must call the zope.testing.trial.tearDown methods.
+
+Our first test we will rerun a test suite which has 1 failing test, 1 test
+which contains an error and a successful test.
+
+    >>> import os.path, sys
+    >>> from zope.testing import testrunner
+    >>> defaults = [
+    ...     '--path', this_directory,
+    ...     '--tests-pattern', '^trialtest$',
+    ...     ]
+
+    >>> sys.argv = 'test --tests-pattern ^trialtest$ '.split()
+    >>> testrunner.run(defaults)
+    ... # doctest: +NORMALIZE_WHITESPACE
+    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 :-)
+    <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
+    <BLANKLINE>
+      Ran 3 tests with 1 failures and 1 errors in N.NNN seconds.
+    True
+
+Here is the output from the same tests above but the setup method contains
+errors.
+
+    >>> sys.argv = 'test --tests-pattern ^trialtestfs$ '.split()
+    >>> testrunner.run(defaults)
+    ... # doctest: +NORMALIZE_WHITESPACE
+    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
+    <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
+    <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
+    <BLANKLINE>
+      Ran 3 tests with 0 failures and 3 errors in N.NNN seconds.
+    True
+
+Here is the output from the same tests but the teardown method contains
+errors.
+
+    >>> sys.argv = 'test --tests-pattern ^trialtestft$ '.split()
+    >>> testrunner.run(defaults)
+    ... # doctest: +NORMALIZE_WHITESPACE
+    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
+    <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 :-)
+    <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
+    <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
+    <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
+    <BLANKLINE>
+      Ran 3 tests with 1 failures and 4 errors in 0.118 seconds.
+    True


Property changes on: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trial.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtest.py
===================================================================
--- Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtest.py	2006-04-03 16:48:29 UTC (rev 66354)
+++ Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtest.py	2006-04-03 17:49:47 UTC (rev 66355)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+__docformat__="restructuredtext"
+
+import unittest
+
+import twisted.trial.unittest
+
+#
+# Now just make sure that all this does what it says.
+#
+
+class TestTrialTests(twisted.trial.unittest.TestCase):
+
+    def setUp(self):
+        pass
+
+    def tearDown(self):
+        pass
+
+    def test_error(self):
+        raise Exception, "this test is a broken trial test :-)"
+
+    def test_failure(self):
+        self.assert_(False, "I am a failed trial test")
+
+    def test_assert_ok(self):
+        self.assert_(True, "I am a good test")
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(TestTrialTests))
+
+    return suite
+
+if __name__ == '__main__':
+    test_suite()


Property changes on: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtest.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestfs.py
===================================================================
--- Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestfs.py	2006-04-03 16:48:29 UTC (rev 66354)
+++ Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestfs.py	2006-04-03 17:49:47 UTC (rev 66355)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+__docformat__="restructuredtext"
+
+import unittest
+
+import twisted.trial.unittest
+
+class TestTrialBrokenSetup(twisted.trial.unittest.TestCase):
+
+    def setUp(self):
+        raise Exception, 'broken setup'
+
+    def tearDown(self):
+        pass
+
+    def test_error(self):
+        raise Exception, "this test is a broken trial test :-)"
+
+    def test_failure(self):
+        self.assert_(False, "I am a failed trial test")
+
+    def test_assert_ok(self):
+        self.assert_(True, "I am a good test")
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(TestTrialBrokenSetup))
+
+    return suite
+
+if __name__ == '__main__':
+    test_suite()


Property changes on: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestfs.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestft.py
===================================================================
--- Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestft.py	2006-04-03 16:48:29 UTC (rev 66354)
+++ Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestft.py	2006-04-03 17:49:47 UTC (rev 66355)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+__docformat__="restructuredtext"
+
+import unittest
+
+import twisted.trial.unittest
+
+class TestTrialBrokenTeardown(twisted.trial.unittest.TestCase):
+
+    def setUp(self):
+        pass
+
+    def tearDown(self):
+        raise Exception, 'broken tearDown'
+
+    def test_error(self):
+        raise Exception, "this test is a broken trial test :-)"
+
+    def test_failure(self):
+        self.assert_(False, "I am a failed trial test")
+
+    def test_assert_ok(self):
+        self.assert_(True, "I am a good test")
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(TestTrialBrokenTeardown))
+
+    return suite
+
+if __name__ == '__main__':
+    test_suite()


Property changes on: Zope3/branches/mkerrin-remove_trial_tests/src/zope/app/twisted/ftp/tests/trialtestft.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Zope3-Checkins mailing list