Merge lp:~mwhudson/launchpad/reenable-layer-profiling-bug-605875 into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Paul Hummer
Approved revision: no longer in the source branch.
Merged at revision: 11168
Proposed branch: lp:~mwhudson/launchpad/reenable-layer-profiling-bug-605875
Merge into: lp:launchpad
Diff against target: 28 lines (+9/-10)
1 file modified
buildout-templates/bin/test.in (+9/-10)
To merge this branch: bzr merge lp:~mwhudson/launchpad/reenable-layer-profiling-bug-605875
Reviewer Review Type Date Requested Status
Paul Hummer (community) code Approve
Review via email: mp+29990@code.launchpad.net

Commit message

Re-enable layer profiling for bin/test -vvv and higher verbosity

Description of the change

As mentioned in the bug report, ./bin/test -vvv no longer prints out the time taken by the various layer methods. This turned out to be because the interface of zope.testrunner.run changed recently to always raise SystemExit, so the code in ./bin/test that printed the results is now never executed.

This branch moves the code into an 'except SystemExit' clause.

To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'buildout-templates/bin/test.in'
--- buildout-templates/bin/test.in 2010-05-15 17:43:59 +0000
+++ buildout-templates/bin/test.in 2010-07-15 13:46:46 +0000
@@ -236,15 +236,14 @@
236 # tree. This is very useful for IDE integration, so an IDE can236 # tree. This is very useful for IDE integration, so an IDE can
237 # e.g. run the test that you are currently editing.237 # e.g. run the test that you are currently editing.
238 try:238 try:
239 there = os.getcwd()239 try:
240 os.chdir(BUILD_DIR)240 there = os.getcwd()
241 result = testrunner.run([])241 os.chdir(BUILD_DIR)
242 testrunner.run([])
243 except SystemExit:
244 # Print Layer profiling report if requested.
245 if main_process and local_options.verbose >= 3:
246 profiled.report_profile_stats()
247 raise
242 finally:248 finally:
243 os.chdir(there)249 os.chdir(there)
244 # Cribbed from sourcecode/zope/test.py - avoid spurious error during exit.
245 logging.disable(999999999)
246
247 # Print Layer profiling report if requested.
248 if main_process and local_options.verbose >= 3:
249 profiled.report_profile_stats()
250 sys.exit(result)