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

Proposed by Michael Hudson-Doyle on 2010-07-15
Status: Merged
Approved by: Paul Hummer on 2010-07-15
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 2010-07-15 Approve on 2010-07-15
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.
Paul Hummer (rockstar) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'buildout-templates/bin/test.in'
2--- buildout-templates/bin/test.in 2010-05-15 17:43:59 +0000
3+++ buildout-templates/bin/test.in 2010-07-15 13:46:46 +0000
4@@ -236,15 +236,14 @@
5 # tree. This is very useful for IDE integration, so an IDE can
6 # e.g. run the test that you are currently editing.
7 try:
8- there = os.getcwd()
9- os.chdir(BUILD_DIR)
10- result = testrunner.run([])
11+ try:
12+ there = os.getcwd()
13+ os.chdir(BUILD_DIR)
14+ testrunner.run([])
15+ except SystemExit:
16+ # Print Layer profiling report if requested.
17+ if main_process and local_options.verbose >= 3:
18+ profiled.report_profile_stats()
19+ raise
20 finally:
21 os.chdir(there)
22- # Cribbed from sourcecode/zope/test.py - avoid spurious error during exit.
23- logging.disable(999999999)
24-
25- # Print Layer profiling report if requested.
26- if main_process and local_options.verbose >= 3:
27- profiled.report_profile_stats()
28- sys.exit(result)