Merge lp:~jml/launchpad/still-more-tests-for-ec2 into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Eleanor Berger
Approved revision: no longer in the source branch.
Merged at revision: 10840
Proposed branch: lp:~jml/launchpad/still-more-tests-for-ec2
Merge into: lp:launchpad
Diff against target: 91 lines (+47/-2)
2 files modified
lib/devscripts/ec2test/remote.py (+4/-2)
lib/devscripts/ec2test/tests/test_remote.py (+43/-0)
To merge this branch: bzr merge lp:~jml/launchpad/still-more-tests-for-ec2
Reviewer Review Type Date Requested Status
Eleanor Berger (community) Approve
Review via email: mp+24503@code.launchpad.net

Commit message

Include all of the make output in the body of ec2 mail. Add some unrelated unit tests for ec2 test.

Description of the change

Hello reviewer,

This branch adds a couple more tests for the ec2-side of ec2test and "fixes" an issue where error messages that occurred during 'make' but before the actual test run were not included in the email body, but instead included in the attachment.

A typical email for a successful test run is pasted below. It's got way too much information in it (whatever happened to "don't make me think"?), but I figure that it shouldn't be the job of the ec2 testing framework to make it less so.

jml

Tests started at approximately Fri, 30 Apr 2010 11:12:58 UTC
bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/, revision 10825

Merged with
bzr+ssh://bazaar.launchpad.net/~jml/launchpad/still-more-tests-for-ec2, revision 10797 (commit message: Include the full makefile. Point to the attachment)

DEPENDENCY BRANCHES USED

- lpreview
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/bzr-lpreview/devel/
   23

- testresources
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/testresources/dev/
   16

- launchpad-loggerhead
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad-loggerhead/devel/
   54

- dulwich
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/dulwich/devel/
   418

- bzr-builder
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/bzr-builder/trunk/
   64

- bzr-loom
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/bzr-loom/trunk/
   47

- bzr-svn
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/bzr-svn/devel/
   2708

- pygpgme
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/pygpgme/devel/
   49

- shipit
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/shipit/trunk/
   8905

- pygettextpo
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/pygettextpo/trunk/
   23

- bzr-git
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/bzr-git/devel/
   253

- old_xmlplus
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/dtdparser/trunk/
   4

- subvertpy
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/subvertpy/trunk/
   2040

- mailman
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/mailman/2.1/
   976

- loggerhead
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/loggerhead/devel/
   176

- cscvs
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad-cscvs/devel/
   432

- bzr-hg
   bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/bzr-hg/devel/
   281

TEST RESULTS FOLLOW

rm -f lib/canonical/launchpad/icing/build/launchpad.js
rm -f -r lazr-js/build
make -C sourcecode/pygettextpo clean
make[1]: Entering directory `/var/launchpad/tmp/sourcecode/pygettextpo'
rm -rf build dist gettextpo.so gettextpo.html
make[1]: Leaving directory `/var/launchpad/tmp/sourcecode/pygettextpo'
# XXX gary 2009-11-16 bug 483782
# The pygettextpo Makefile should have this next line in it for its make
# clean, and then we should remove this line.
rm -f sourcecode/pygpgme/gpgme/*.so
if test -f sourcecode/mailman/Makefile; then \
               make -C sourcecode/mailman clean; \
       fi
find . -path ./eggs -prune -false -o \
               -type f \( -name '*.o' -o -name '*.so' -o -name '*.la' -o \
           -name '*.lo' -o -name '*.py[co]' -o -name '*.dll' \) \
           -print0 | xargs -r0 rm -f
rm -f -r bin
rm -f -r parts
rm -f -r develop-eggs
rm -f .installed.cfg
rm -f -r build
rm -f thread*.request
rm -f -r lib/mailman
rm -f -rf lib/canonical/launchpad/icing/build/*
rm -f -r /var/tmp/bazaar.launchpad.dev
rm -f lib/canonical/launchpad/apidoc/wadl*.xml lib/canonical/launchpad/apidoc/*.html
rm -f -rf lib/canonical/launchpad/apidoc.tmp
rm -f bzr-version-info.py
rm -f _pythonpath.py
rm -f +config-overrides.zcml
rm -f -rf \
                         /var/tmp/builddmaster \
                         /var/tmp/bzrsync \
                         /var/tmp/codehosting.test \
                         /var/tmp/codeimport \
                         /var/tmp/fatsam.appserver \
                         /var/tmp/lperr \
                         /var/tmp/lperr.test \
                         /var/tmp/mailman \
                         /var/tmp/mailman-xmlrpc.test \
                         /var/tmp/ppa \
                         /var/tmp/ppa.test \
                         /var/tmp/zeca
# /var/tmp/launchpad_mailqueue is created read-only on ec2test
# instances.
if [ -w /var/tmp/launchpad_mailqueue ]; then rm -f -rf /var/tmp/launchpad_mailqueue; fi
rm -f -f lp.sfood lp-clustered.sfood lp-clustered.dot lp-clustered.svg
utilities/shhh.py PYTHONPATH= python2.5 bootstrap.py\
               --setup-source=ez_setup.py \
               --download-base=download-cache/dist --eggs=eggs
rm -f /var/launchpad/test/bin/py
utilities/shhh.py PYTHONPATH= ./bin/buildout \
               configuration:instance_name=development -c buildout.cfg
scripts/update-bzr-version-info.sh
Creating bzr-version-info.py at revno 10825
utilities/shhh.py make -C sourcecode build PYTHON=python2.5 \
           PYTHON_VERSION=2.5 LPCONFIG=development
utilities/shhh.py LPCONFIG=development /var/launchpad/test/bin/py -t buildmailman.py
mkdir -p lib/canonical/launchpad/apidoc.tmp
LPCONFIG=development /var/launchpad/test/bin/py ./utilities/create-lp-wadl-and-apidoc.py "lib/canonical/launchpad/apidoc.tmp/wadl-development-%(version)s.xml"
Unknown entry URL:
                   archive_dependency
Unknown entry URL:
                   archive_subscriber
Unknown entry URL:
                   binary_package_release_download_count
Unknown entry URL:
                   branch_subscription
Unknown entry URL:
                   bug_branch
Unknown entry URL:
                   bug_nomination
Unknown entry URL:
                   code_import
Unknown entry URL:
                   code_review_comment
Unknown entry URL:
                   code_review_vote_reference
Unknown entry URL:
                   country
Unknown entry URL:
                   distribution_mirror
Unknown entry URL:
                   gpg_key
Unknown entry URL:
                   h_w_driver_name
Unknown entry URL:
                   h_w_driver_package_name
Unknown entry URL:
                   hwdb
Unknown entry URL:
                   object_with_translation_imports
Unknown entry URL:
                   package_upload
Unknown entry URL:
                   packageset
Unknown entry URL:
                   preview_diff
Unknown entry URL:
                   source_package_recipe
Unknown entry URL:
                   source_package_recipe_build
Unknown entry URL:
                   specification
Unknown entry URL:
                   specification_branch
Unknown entry URL:
                   ssh_key
Unknown entry URL:
                   structural_subscription
Unknown entry URL:
                   structural_subscription_target
Unknown entry URL:
                   temporary_blob
Unknown entry URL:
                   translation_import_queue_entry
Unknown entry URL:
                   archive_dependency
Unknown entry URL:
                   archive_subscriber
Unknown entry URL:
                   binary_package_release_download_count
Unknown entry URL:
                   branch_subscription
Unknown entry URL:
                   bug_branch
Unknown entry URL:
                   bug_nomination
Unknown entry URL:
                   code_import
Unknown entry URL:
                   code_review_comment
Unknown entry URL:
                   code_review_vote_reference
Unknown entry URL:
                   country
Unknown entry URL:
                   distribution_mirror
Unknown entry URL:
                   gpg_key
Unknown entry URL:
                   h_w_driver_name
Unknown entry URL:
                   h_w_driver_package_name
Unknown entry URL:
                   hwdb
Unknown entry URL:
                   object_with_translation_imports
Unknown entry URL:
                   package_upload
Unknown entry URL:
                   packageset
Unknown entry URL:
                   preview_diff
Unknown entry URL:
                   source_package_recipe
Unknown entry URL:
                   source_package_recipe_build
Unknown entry URL:
                   specification
Unknown entry URL:
                   specification_branch
Unknown entry URL:
                   ssh_key
Unknown entry URL:
                   structural_subscription
Unknown entry URL:
                   structural_subscription_target
Unknown entry URL:
                   temporary_blob
Unknown entry URL:
                   translation_import_queue_entry
Writing WADL for version beta to lib/canonical/launchpad/apidoc.tmp/wadl-development-beta.xml.
Writing apidoc for version beta to lib/canonical/launchpad/apidoc.tmp/beta.html
Writing WADL for version 1.0 to lib/canonical/launchpad/apidoc.tmp/wadl-development-1.0.xml.
Writing apidoc for version 1.0 to lib/canonical/launchpad/apidoc.tmp/1.0.html
Writing WADL for version devel to lib/canonical/launchpad/apidoc.tmp/wadl-development-devel.xml.
Writing apidoc for version devel to lib/canonical/launchpad/apidoc.tmp/devel.html
Unknown entry URL:
                   archive_dependency
Unknown entry URL:
                   archive_subscriber
Unknown entry URL:
                   binary_package_release_download_count
Unknown entry URL:
                   branch_subscription
Unknown entry URL:
                   bug_branch
Unknown entry URL:
                   bug_nomination
Unknown entry URL:
                   code_import
Unknown entry URL:
                   code_review_comment
Unknown entry URL:
                   code_review_vote_reference
Unknown entry URL:
                   country
Unknown entry URL:
                   distribution_mirror
Unknown entry URL:
                   gpg_key
Unknown entry URL:
                   h_w_driver_name
Unknown entry URL:
                   h_w_driver_package_name
Unknown entry URL:
                   hwdb
Unknown entry URL:
                   object_with_translation_imports
Unknown entry URL:
                   package_upload
Unknown entry URL:
                   packageset
Unknown entry URL:
                   preview_diff
Unknown entry URL:
                   source_package_recipe
Unknown entry URL:
                   source_package_recipe_build
Unknown entry URL:
                   specification
Unknown entry URL:
                   specification_branch
Unknown entry URL:
                   ssh_key
Unknown entry URL:
                   structural_subscription
Unknown entry URL:
                   structural_subscription_target
Unknown entry URL:
                   temporary_blob
Unknown entry URL:
                   translation_import_queue_entry
mv lib/canonical/launchpad/apidoc.tmp/* lib/canonical/launchpad/apidoc
rmdir lib/canonical/launchpad/apidoc.tmp
# We absolutely do not want to include the lazr.testing module and its
# jsTestDriver test harness modifications in the lazr.js and launchpad.js
# roll-up files. They fiddle with built-in functions! See Bug 482340.
utilities/shhh.py bin/jsbuild -b lazr-js/build -x testing/ -c lazr-js/build/yui
utilities/shhh.py bin/jsbuild \
                \
               -n launchpad \
               -s lib/canonical/launchpad/javascript \
               -b lib/canonical/launchpad/icing/build \
               /var/launchpad/test/lib/canonical/launchpad/icing/yui/yui/yui-base-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/yui/yui-log-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/yui/yui-later-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/oop/oop-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/event/event-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/event/event-key-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/event-custom/event-custom-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/event-simulate/event-simulate-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/dom/dom-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/node/node-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/node-focusmanager/node-focusmanager-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/node/node-event-simulate-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/dump/dump-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/io/io-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/json/json-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/attribute/attribute-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/base/base-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/substitute/substitute-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/anim/anim-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/classnamemanager/classnamemanager-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/plugin/plugin-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/pluginhost/pluginhost-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/widget/widget-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/widget/widget-position-ext-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/cookie/cookie-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/widget/widget-position-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/widget/widget-position-ext-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/widget/widget-stack-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/widget/widget-stdmod-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/overlay/overlay-min.js /var/launchpad/test/lib/canonical/launchpad/icing/yui/node-menunav/node-menunav-min.js \
               /var/launchpad/test/lib/lp/code/javascript/branch.bugspeclinks.js /var/launchpad/test/lib/lp/code/javascript/branchmergeproposal.reviewcomment.js /var/launchpad/test/lib/lp/code/javascript/branchmergeproposal.status.js /var/launchpad/test/lib/lp/code/javascript/productseries-setbranch.js /var/launchpad/test/lib/lp/code/javascript/branch.subscription.js /var/launchpad/test/lib/lp/code/javascript/branch.status.js /var/launchpad/test/lib/lp/code/javascript/branchmergeproposal.diff.js \
               lib/canonical/launchpad/icing/lazr/build/lazr.js
utilities/shhh.py bin/jssize
utilities/shhh.py bin/sprite-util create-css
utilities/shhh.py bin/combine-css
# Run all tests. test_on_merge.py takes care of setting up the
# database.
/var/launchpad/test/bin/py -t ./test_on_merge.py --subunit -vvv
2010-04-30 11:22:04 INFO Applying patches to unreplicated environment.
2010-04-30 11:22:04 INFO Applying trusted.sql
2010-04-30 11:22:04 INFO Applying patch-2207-00-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-00-1.sql
2010-04-30 11:22:04 INFO Applying patch-2207-00-2.sql
2010-04-30 11:22:04 INFO Applying patch-2207-00-3.sql
2010-04-30 11:22:04 INFO Applying patch-2207-01-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-02-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-03-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-04-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-05-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-06-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-08-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-09-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-10-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-11-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-12-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-14-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-15-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-15-1.sql
2010-04-30 11:22:04 INFO Applying patch-2207-16-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-17-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-18-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-19-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-19-1.sql
2010-04-30 11:22:04 INFO Applying patch-2207-20-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-21-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-23-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-24-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-25-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-26-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-27-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-28-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-28-1.sql
2010-04-30 11:22:04 INFO Applying patch-2207-29-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-30-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-31-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-32-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-33-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-34-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-35-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-35-1.sql
2010-04-30 11:22:04 INFO Applying patch-2207-35-2.sql
2010-04-30 11:22:04 INFO Applying patch-2207-36-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-37-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-38-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-39-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-40-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-41-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-42-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-43-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-44-0.sql
2010-04-30 11:22:04 INFO Applying patch-2207-45-0.sql
2010-04-30 11:22:04 INFO Applying comments.sql
2010-04-30 11:22:43 WARNING No permissions specified for [u'public.lp_account', u'public.lp_teamparticipation', u'public.lp_personlocation', u'public.bug_update_latest_patch_uploaded(integer)', u'public.lp_person']
Running tests.
xvfb-run -s '-screen 0 1024x768x24' /var/launchpad/test/bin/test --subunit -vvv

No handlers could be found for logger "lazr.smtptest"
No handlers could be found for logger "lazr.smtptest"
No handlers could be found for logger "lazr.smtptest"

Started ['/tmp/tmp9408Kx.mozrunner/mozrunner-firefox', '-profile', '/tmp/tmp9408Kx.mozrunner', 'http://bugs.launchpad.dev:8085/windmill-serv/start.html']
No handlers could be found for logger "lazr.smtptest"

Started ['/tmp/tmpUCaXGu.mozrunner/mozrunner-firefox', '-profile', '/tmp/tmpUCaXGu.mozrunner', 'http://code.launchpad.dev:8085/windmill-serv/start.html']
No handlers could be found for logger "lazr.smtptest"
No handlers could be found for logger "lazr.smtptest"

Started ['/tmp/tmpgbsfyH.mozrunner/mozrunner-firefox', '-profile', '/tmp/tmpgbsfyH.mozrunner', 'http://launchpad.dev:8085/windmill-serv/start.html']
No handlers could be found for logger "lazr.smtptest"

Started ['/tmp/tmphwYsyb.mozrunner/mozrunner-firefox', '-profile', '/tmp/tmphwYsyb.mozrunner', 'http://launchpad.dev:8085/windmill-serv/start.html']
No handlers could be found for logger "lazr.smtptest"

Started ['/tmp/tmpKNdZ4u.mozrunner/mozrunner-firefox', '-profile', '/tmp/tmpKNdZ4u.mozrunner', 'http://translations.launchpad.dev:8085/windmill-serv/start.html']
No handlers could be found for logger "lazr.smtptest"
Iterating with success flag 0 against

To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/devscripts/ec2test/remote.py'
--- lib/devscripts/ec2test/remote.py 2010-04-28 11:37:02 +0000
+++ lib/devscripts/ec2test/remote.py 2010-05-09 12:56:33 +0000
@@ -190,6 +190,9 @@
190 conn.send_email(self.pqm_message)190 conn.send_email(self.pqm_message)
191 summary_file.write(191 summary_file.write(
192 '\n\nSUBMITTED TO PQM:\n%s\n' % (subject,))192 '\n\nSUBMITTED TO PQM:\n%s\n' % (subject,))
193
194 summary_file.write(
195 '\n(See the attached file for the complete log)\n')
193 except:196 except:
194 summary_file.write('\n\nERROR IN TESTRUNNER\n\n')197 summary_file.write('\n\nERROR IN TESTRUNNER\n\n')
195 traceback.print_exc(file=summary_file)198 traceback.print_exc(file=summary_file)
@@ -259,8 +262,7 @@
259 # Only write to stdout if we are running as the foreground process.262 # Only write to stdout if we are running as the foreground process.
260 echo_to_stdout = not self.daemonized263 echo_to_stdout = not self.daemonized
261 result = SummaryResult(summary_file)264 result = SummaryResult(summary_file)
262 subunit_server = subunit.TestProtocolServer(265 subunit_server = subunit.TestProtocolServer(result, summary_file)
263 result, FlagFallStream(summary_file, 'Running tests.'))
264 for line in input_stream:266 for line in input_stream:
265 subunit_server.lineReceived(line)267 subunit_server.lineReceived(line)
266 out_file.write(line)268 out_file.write(line)
267269
=== modified file 'lib/devscripts/ec2test/tests/test_remote.py'
--- lib/devscripts/ec2test/tests/test_remote.py 2010-04-28 11:59:31 +0000
+++ lib/devscripts/ec2test/tests/test_remote.py 2010-05-09 12:56:33 +0000
@@ -6,6 +6,7 @@
6__metaclass__ = type6__metaclass__ = type
77
8from StringIO import StringIO8from StringIO import StringIO
9import sys
9import unittest10import unittest
1011
11from devscripts.ec2test.remote import SummaryResult12from devscripts.ec2test.remote import SummaryResult
@@ -14,6 +15,14 @@
14class TestSummaryResult(unittest.TestCase):15class TestSummaryResult(unittest.TestCase):
15 """Tests for `SummaryResult`."""16 """Tests for `SummaryResult`."""
1617
18 def makeException(self, factory=None, *args, **kwargs):
19 if factory is None:
20 factory = RuntimeError
21 try:
22 raise factory(*args, **kwargs)
23 except:
24 return sys.exc_info()
25
17 def test_printError(self):26 def test_printError(self):
18 # SummaryResult.printError() prints out the name of the test, the kind27 # SummaryResult.printError() prints out the name of the test, the kind
19 # of error and the details of the error in a nicely-formatted way.28 # of error and the details of the error in a nicely-formatted way.
@@ -24,6 +33,40 @@
24 result.double_line, result.single_line)33 result.double_line, result.single_line)
25 self.assertEqual(expected, stream.getvalue())34 self.assertEqual(expected, stream.getvalue())
2635
36 def test_addError(self):
37 # SummaryResult.addError() prints a nicely-formatted error.
38 #
39 # First, use printError to build the error text we expect.
40 test = self
41 stream = StringIO()
42 result = SummaryResult(stream)
43 error = self.makeException()
44 result.printError(
45 'ERROR', test, result._exc_info_to_string(error, test))
46 expected = stream.getvalue()
47 # Now, call addError and check that it matches.
48 stream = StringIO()
49 result = SummaryResult(stream)
50 result.addError(test, error)
51 self.assertEqual(expected, stream.getvalue())
52
53 def test_addFailure(self):
54 # SummaryResult.addFailure() prints a nicely-formatted error.
55 #
56 # First, use printError to build the error text we expect.
57 test = self
58 stream = StringIO()
59 result = SummaryResult(stream)
60 error = self.makeException(test.failureException)
61 result.printError(
62 'FAILURE', test, result._exc_info_to_string(error, test))
63 expected = stream.getvalue()
64 # Now, call addFailure and check that it matches.
65 stream = StringIO()
66 result = SummaryResult(stream)
67 result.addFailure(test, error)
68 self.assertEqual(expected, stream.getvalue())
69
2770
28def test_suite():71def test_suite():
29 return unittest.TestLoader().loadTestsFromName(__name__)72 return unittest.TestLoader().loadTestsFromName(__name__)