Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: testing_support/coverage_utils.py

Issue 26109002: Add git-number script to calculate generation numbers for commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: address comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import os
6 import sys
7 import unittest
8
M-A Ruel 2013/11/08 19:32:23 2 lines
iannucci 2013/11/11 22:59:24 Done.
9 def covered_main(includes):
10 """Equivalent of unittest.main(), except that it gathers coverage data, and
11 asserts if the test is not at 100% coverage.
12
13 Args:
14 includes (list(str) or str) - List of paths to include in coverage report.
15 May also be a single path instead of a list.
16 """
17 try:
18 import coverage
19 except ImportError:
20 sys.path.insert(0,
21 os.path.abspath(os.path.join(
22 os.path.dirname(os.path.dirname(__file__)), 'third_party')))
23 import coverage
24 COVERAGE = coverage.coverage(include=includes)
25 COVERAGE.start()
26
27 retcode = 0
28 try:
29 unittest.main()
30 except SystemExit as e:
31 retcode = e.code or retcode
32
33 COVERAGE.stop()
34 if COVERAGE.report() != 100.0:
35 print "FATAL: not at 100% coverage."
36 retcode = 2
37
38 return retcode
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698