Thu, 17 Sep 2020 19:10:36 +0200
Third Party packages: updated coverage.py to 5.3.0.
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
1 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
2 | # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
4 | """Command-line support for coverage.py.""" |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
6 | from __future__ import print_function |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
7 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
8 | import glob |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
9 | import optparse |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
10 | import os.path |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
11 | import shlex |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
12 | import sys |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
13 | import textwrap |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
14 | import traceback |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
15 | |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
16 | import coverage |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
17 | from coverage import Coverage |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
18 | from coverage import env |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
19 | from coverage.collector import CTracer |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
20 | from coverage.data import line_counts |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
21 | from coverage.debug import info_formatter, info_header, short_stack |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
22 | from coverage.execfile import PyRunner |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
23 | from coverage.misc import BaseCoverageException, ExceptionDuringRun, NoSource, output_encoding |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
24 | from coverage.results import should_fail_under |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
26 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
27 | class Opts(object): |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
28 | """A namespace class for individual options we'll build parsers from.""" |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
29 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
30 | append = optparse.make_option( |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
31 | '-a', '--append', action='store_true', |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
32 | help="Append coverage data to .coverage, otherwise it starts clean each time.", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
33 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
34 | branch = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
35 | '', '--branch', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
36 | help="Measure branch coverage in addition to statement coverage.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
37 | ) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
38 | CONCURRENCY_CHOICES = [ |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
39 | "thread", "gevent", "greenlet", "eventlet", "multiprocessing", |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
40 | ] |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
41 | concurrency = optparse.make_option( |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
42 | '', '--concurrency', action='store', metavar="LIB", |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
43 | choices=CONCURRENCY_CHOICES, |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
44 | help=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
45 | "Properly measure code using a concurrency library. " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
46 | "Valid values are: %s." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
47 | ) % ", ".join(CONCURRENCY_CHOICES), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
48 | ) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
49 | context = optparse.make_option( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
50 | '', '--context', action='store', metavar="LABEL", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
51 | help="The context label to record for this coverage run.", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
52 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
53 | debug = optparse.make_option( |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
54 | '', '--debug', action='store', metavar="OPTS", |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
55 | help="Debug options, separated by commas. [env: COVERAGE_DEBUG]", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
56 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
57 | directory = optparse.make_option( |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
58 | '-d', '--directory', action='store', metavar="DIR", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
59 | help="Write the output files to DIR.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
60 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
61 | fail_under = optparse.make_option( |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
62 | '', '--fail-under', action='store', metavar="MIN", type="float", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
63 | help="Exit with a status of 2 if the total coverage is less than MIN.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
64 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
65 | help = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
66 | '-h', '--help', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
67 | help="Get help on this command.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
68 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
69 | ignore_errors = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
70 | '-i', '--ignore-errors', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
71 | help="Ignore errors while reading source files.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
72 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
73 | include = optparse.make_option( |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
74 | '', '--include', action='store', |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
75 | metavar="PAT1,PAT2,...", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
76 | help=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
77 | "Include only files whose paths match one of these patterns. " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
78 | "Accepts shell-style wildcards, which must be quoted." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
79 | ), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
80 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
81 | pylib = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
82 | '-L', '--pylib', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
83 | help=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
84 | "Measure coverage even inside the Python installed library, " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
85 | "which isn't done by default." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
86 | ), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
87 | ) |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
88 | sort = optparse.make_option( |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
89 | '--sort', action='store', metavar='COLUMN', |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
90 | help="Sort the report by the named column: name, stmts, miss, branch, brpart, or cover. " |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
91 | "Default is name." |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
92 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
93 | show_missing = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
94 | '-m', '--show-missing', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
95 | help="Show line numbers of statements in each module that weren't executed.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
96 | ) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
97 | skip_covered = optparse.make_option( |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
98 | '--skip-covered', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
99 | help="Skip files with 100% coverage.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
100 | ) |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
101 | no_skip_covered = optparse.make_option( |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
102 | '--no-skip-covered', action='store_false', dest='skip_covered', |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
103 | help="Disable --skip-covered.", |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
104 | ) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
105 | skip_empty = optparse.make_option( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
106 | '--skip-empty', action='store_true', |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
107 | help="Skip files with no code.", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
108 | ) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
109 | show_contexts = optparse.make_option( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
110 | '--show-contexts', action='store_true', |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
111 | help="Show contexts for covered lines.", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
112 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
113 | omit = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
114 | '', '--omit', action='store', |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
115 | metavar="PAT1,PAT2,...", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
116 | help=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
117 | "Omit files whose paths match one of these patterns. " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
118 | "Accepts shell-style wildcards, which must be quoted." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
119 | ), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
120 | ) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
121 | contexts = optparse.make_option( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
122 | '', '--contexts', action='store', |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
123 | metavar="REGEX1,REGEX2,...", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
124 | help=( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
125 | "Only display data from lines covered in the given contexts. " |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
126 | "Accepts Python regexes, which must be quoted." |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
127 | ), |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
128 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
129 | output_xml = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
130 | '-o', '', action='store', dest="outfile", |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
131 | metavar="OUTFILE", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
132 | help="Write the XML report to this file. Defaults to 'coverage.xml'", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
133 | ) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
134 | output_json = optparse.make_option( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
135 | '-o', '', action='store', dest="outfile", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
136 | metavar="OUTFILE", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
137 | help="Write the JSON report to this file. Defaults to 'coverage.json'", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
138 | ) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
139 | json_pretty_print = optparse.make_option( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
140 | '', '--pretty-print', action='store_true', |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
141 | help="Format the JSON for human readers.", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
142 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
143 | parallel_mode = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
144 | '-p', '--parallel-mode', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
145 | help=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
146 | "Append the machine name, process id and random number to the " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
147 | ".coverage data file name to simplify collecting data from " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
148 | "many processes." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
149 | ), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
150 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
151 | module = optparse.make_option( |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
152 | '-m', '--module', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
153 | help=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
154 | "<pyfile> is an importable Python module, not a script path, " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
155 | "to be run as 'python -m' would run it." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
156 | ), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
157 | ) |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
158 | precision = optparse.make_option( |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
159 | '', '--precision', action='store', metavar='N', type=int, |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
160 | help=( |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
161 | "Number of digits after the decimal point to display for " |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
162 | "reported coverage percentages." |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
163 | ), |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
164 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
165 | rcfile = optparse.make_option( |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
166 | '', '--rcfile', action='store', |
6649
f1b3a73831c9
coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6219
diff
changeset
|
167 | help=( |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
168 | "Specify configuration file. " |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
169 | "By default '.coveragerc', 'setup.cfg', 'tox.ini', and " |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
170 | "'pyproject.toml' are tried. [env: COVERAGE_RCFILE]" |
6649
f1b3a73831c9
coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6219
diff
changeset
|
171 | ), |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
172 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
173 | source = optparse.make_option( |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
174 | '', '--source', action='store', metavar="SRC1,SRC2,...", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
175 | help="A list of packages or directories of code to be measured.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
176 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
177 | timid = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
178 | '', '--timid', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
179 | help=( |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
180 | "Use a simpler but slower trace method. Try this if you get " |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
181 | "seemingly impossible results!" |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
182 | ), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
183 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
184 | title = optparse.make_option( |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
185 | '', '--title', action='store', metavar="TITLE", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
186 | help="A text string to use as the title on the HTML.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
187 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
188 | version = optparse.make_option( |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
189 | '', '--version', action='store_true', |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
190 | help="Display version information and exit.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
191 | ) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
192 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
193 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
194 | class CoverageOptionParser(optparse.OptionParser, object): |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
195 | """Base OptionParser for coverage.py. |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
196 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
197 | Problems don't exit the program. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
198 | Defaults are initialized for all options. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
199 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
200 | """ |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
201 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
202 | def __init__(self, *args, **kwargs): |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
203 | super(CoverageOptionParser, self).__init__( |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
204 | add_help_option=False, *args, **kwargs |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
205 | ) |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
206 | self.set_defaults( |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
207 | action=None, |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
208 | append=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
209 | branch=None, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
210 | concurrency=None, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
211 | context=None, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
212 | debug=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
213 | directory=None, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
214 | fail_under=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
215 | help=None, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
216 | ignore_errors=None, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
217 | include=None, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
218 | module=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
219 | omit=None, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
220 | contexts=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
221 | parallel_mode=None, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
222 | precision=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
223 | pylib=None, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
224 | rcfile=True, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
225 | show_missing=None, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
226 | skip_covered=None, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
227 | skip_empty=None, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
228 | show_contexts=None, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
229 | sort=None, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
230 | source=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
231 | timid=None, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
232 | title=None, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
233 | version=None, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
234 | ) |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
235 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
236 | self.disable_interspersed_args() |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
237 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
238 | class OptionParserError(Exception): |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
239 | """Used to stop the optparse error handler ending the process.""" |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
240 | pass |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
241 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
242 | def parse_args_ok(self, args=None, options=None): |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
243 | """Call optparse.parse_args, but return a triple: |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
244 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
245 | (ok, options, args) |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
246 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
247 | """ |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
248 | try: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
249 | options, args = super(CoverageOptionParser, self).parse_args(args, options) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
250 | except self.OptionParserError: |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
251 | return False, None, None |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
252 | return True, options, args |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
253 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
254 | def error(self, msg): |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
255 | """Override optparse.error so sys.exit doesn't get called.""" |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
256 | show_help(msg) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
257 | raise self.OptionParserError |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
258 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
259 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
260 | class GlobalOptionParser(CoverageOptionParser): |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
261 | """Command-line parser for coverage.py global option arguments.""" |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
262 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
263 | def __init__(self): |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
264 | super(GlobalOptionParser, self).__init__() |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
265 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
266 | self.add_options([ |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
267 | Opts.help, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
268 | Opts.version, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
269 | ]) |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
270 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
271 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
272 | class CmdOptionParser(CoverageOptionParser): |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
273 | """Parse one of the new-style commands for coverage.py.""" |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
274 | |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
275 | def __init__(self, action, options, defaults=None, usage=None, description=None): |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
276 | """Create an OptionParser for a coverage.py command. |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
277 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
278 | `action` is the slug to put into `options.action`. |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
279 | `options` is a list of Option's for the command. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
280 | `defaults` is a dict of default value for options. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
281 | `usage` is the usage string to display in help. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
282 | `description` is the description of the command, for the help text. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
283 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
284 | """ |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
285 | if usage: |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
286 | usage = "%prog " + usage |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
287 | super(CmdOptionParser, self).__init__( |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
288 | usage=usage, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
289 | description=description, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
290 | ) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
291 | self.set_defaults(action=action, **(defaults or {})) |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
292 | self.add_options(options) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
293 | self.cmd = action |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
294 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
295 | def __eq__(self, other): |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
296 | # A convenience equality, so that I can put strings in unit test |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
297 | # results, and they will compare equal to objects. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
298 | return (other == "<CmdOptionParser:%s>" % self.cmd) |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
299 | |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
300 | __hash__ = None # This object doesn't need to be hashed. |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
301 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
302 | def get_prog_name(self): |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
303 | """Override of an undocumented function in optparse.OptionParser.""" |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
304 | program_name = super(CmdOptionParser, self).get_prog_name() |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
305 | |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
306 | # Include the sub-command for this parser as part of the command. |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
307 | return "{command} {subcommand}".format(command=program_name, subcommand=self.cmd) |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
308 | |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
309 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
310 | GLOBAL_ARGS = [ |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
311 | Opts.debug, |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
312 | Opts.help, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
313 | Opts.rcfile, |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
314 | ] |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
315 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
316 | CMDS = { |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
317 | 'annotate': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
318 | "annotate", |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
319 | [ |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
320 | Opts.directory, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
321 | Opts.ignore_errors, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
322 | Opts.include, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
323 | Opts.omit, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
324 | ] + GLOBAL_ARGS, |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
325 | usage="[options] [modules]", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
326 | description=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
327 | "Make annotated copies of the given files, marking statements that are executed " |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
328 | "with > and statements that are missed with !." |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
329 | ), |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
330 | ), |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
331 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
332 | 'combine': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
333 | "combine", |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
334 | [ |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
335 | Opts.append, |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
336 | ] + GLOBAL_ARGS, |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
337 | usage="[options] <path1> <path2> ... <pathN>", |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
338 | description=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
339 | "Combine data from multiple coverage files collected " |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
340 | "with 'run -p'. The combined results are written to a single " |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
341 | "file representing the union of the data. The positional " |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
342 | "arguments are data files or directories containing data files. " |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
343 | "If no paths are provided, data files in the default data file's " |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
344 | "directory are combined." |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
345 | ), |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
346 | ), |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
347 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
348 | 'debug': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
349 | "debug", GLOBAL_ARGS, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
350 | usage="<topic>", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
351 | description=( |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
352 | "Display information about the internals of coverage.py, " |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
353 | "for diagnosing problems. " |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
354 | "Topics are: " |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
355 | "'data' to show a summary of the collected data; " |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
356 | "'sys' to show installation information; " |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
357 | "'config' to show the configuration; " |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
358 | "'premain' to show what is calling coverage." |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
359 | ), |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
360 | ), |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
361 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
362 | 'erase': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
363 | "erase", GLOBAL_ARGS, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
364 | description="Erase previously collected coverage data.", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
365 | ), |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
366 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
367 | 'help': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
368 | "help", GLOBAL_ARGS, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
369 | usage="[command]", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
370 | description="Describe how to use coverage.py", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
371 | ), |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
372 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
373 | 'html': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
374 | "html", |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
375 | [ |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
376 | Opts.contexts, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
377 | Opts.directory, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
378 | Opts.fail_under, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
379 | Opts.ignore_errors, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
380 | Opts.include, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
381 | Opts.omit, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
382 | Opts.precision, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
383 | Opts.show_contexts, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
384 | Opts.skip_covered, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
385 | Opts.no_skip_covered, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
386 | Opts.skip_empty, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
387 | Opts.title, |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
388 | ] + GLOBAL_ARGS, |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
389 | usage="[options] [modules]", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
390 | description=( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
391 | "Create an HTML report of the coverage of the files. " |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
392 | "Each file gets its own page, with the source decorated to show " |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
393 | "executed, excluded, and missed lines." |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
394 | ), |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
395 | ), |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
396 | |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
397 | 'json': CmdOptionParser( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
398 | "json", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
399 | [ |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
400 | Opts.contexts, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
401 | Opts.fail_under, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
402 | Opts.ignore_errors, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
403 | Opts.include, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
404 | Opts.omit, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
405 | Opts.output_json, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
406 | Opts.json_pretty_print, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
407 | Opts.show_contexts, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
408 | ] + GLOBAL_ARGS, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
409 | usage="[options] [modules]", |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
410 | description="Generate a JSON report of coverage results." |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
411 | ), |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
412 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
413 | 'report': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
414 | "report", |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
415 | [ |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
416 | Opts.contexts, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
417 | Opts.fail_under, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
418 | Opts.ignore_errors, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
419 | Opts.include, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
420 | Opts.omit, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
421 | Opts.precision, |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
422 | Opts.sort, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
423 | Opts.show_missing, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
424 | Opts.skip_covered, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
425 | Opts.no_skip_covered, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
426 | Opts.skip_empty, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
427 | ] + GLOBAL_ARGS, |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
428 | usage="[options] [modules]", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
429 | description="Report coverage statistics on modules." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
430 | ), |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
431 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
432 | 'run': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
433 | "run", |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
434 | [ |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
435 | Opts.append, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
436 | Opts.branch, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
437 | Opts.concurrency, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
438 | Opts.context, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
439 | Opts.include, |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
440 | Opts.module, |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
441 | Opts.omit, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
442 | Opts.pylib, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
443 | Opts.parallel_mode, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
444 | Opts.source, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
445 | Opts.timid, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
446 | ] + GLOBAL_ARGS, |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
447 | usage="[options] <pyfile> [program options]", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
448 | description="Run a Python program, measuring code execution." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
449 | ), |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
450 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
451 | 'xml': CmdOptionParser( |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
452 | "xml", |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
453 | [ |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
454 | Opts.fail_under, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
455 | Opts.ignore_errors, |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
456 | Opts.include, |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
457 | Opts.omit, |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
458 | Opts.output_xml, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
459 | Opts.skip_empty, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
460 | ] + GLOBAL_ARGS, |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
461 | usage="[options] [modules]", |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
462 | description="Generate an XML report of coverage results." |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
463 | ), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
464 | } |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
465 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
466 | |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
467 | def show_help(error=None, topic=None, parser=None): |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
468 | """Display an error message, or the named topic.""" |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
469 | assert error or topic or parser |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
470 | |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
471 | program_path = sys.argv[0] |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
472 | if program_path.endswith(os.path.sep + '__main__.py'): |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
473 | # The path is the main module of a package; get that path instead. |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
474 | program_path = os.path.dirname(program_path) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
475 | program_name = os.path.basename(program_path) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
476 | if env.WINDOWS: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
477 | # entry_points={'console_scripts':...} on Windows makes files |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
478 | # called coverage.exe, coverage3.exe, and coverage-3.5.exe. These |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
479 | # invoke coverage-script.py, coverage3-script.py, and |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
480 | # coverage-3.5-script.py. argv[0] is the .py file, but we want to |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
481 | # get back to the original form. |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
482 | auto_suffix = "-script.py" |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
483 | if program_name.endswith(auto_suffix): |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
484 | program_name = program_name[:-len(auto_suffix)] |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
485 | |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
486 | help_params = dict(coverage.__dict__) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
487 | help_params['program_name'] = program_name |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
488 | if CTracer is not None: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
489 | help_params['extension_modifier'] = 'with C extension' |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
490 | else: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
491 | help_params['extension_modifier'] = 'without C extension' |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
492 | |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
493 | if error: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
494 | print(error, file=sys.stderr) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
495 | print("Use '%s help' for help." % (program_name,), file=sys.stderr) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
496 | elif parser: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
497 | print(parser.format_help().strip()) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
498 | print() |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
499 | else: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
500 | help_msg = textwrap.dedent(HELP_TOPICS.get(topic, '')).strip() |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
501 | if help_msg: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
502 | print(help_msg.format(**help_params)) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
503 | else: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
504 | print("Don't know topic %r" % topic) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
505 | print("Full documentation is at {__url__}".format(**help_params)) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
506 | |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
507 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
508 | OK, ERR, FAIL_UNDER = 0, 1, 2 |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
509 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
510 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
511 | class CoverageScript(object): |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
512 | """The command-line interface to coverage.py.""" |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
513 | |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
514 | def __init__(self): |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
515 | self.global_option = False |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
516 | self.coverage = None |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
517 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
518 | def command_line(self, argv): |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
519 | """The bulk of the command line interface to coverage.py. |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
520 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
521 | `argv` is the argument list to process. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
522 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
523 | Returns 0 if all is well, 1 if something went wrong. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
524 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
525 | """ |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
526 | # Collect the command-line options. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
527 | if not argv: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
528 | show_help(topic='minimum_help') |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
529 | return OK |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
530 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
531 | # The command syntax we parse depends on the first argument. Global |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
532 | # switch syntax always starts with an option. |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
533 | self.global_option = argv[0].startswith('-') |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
534 | if self.global_option: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
535 | parser = GlobalOptionParser() |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
536 | else: |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
537 | parser = CMDS.get(argv[0]) |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
538 | if not parser: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
539 | show_help("Unknown command: '%s'" % argv[0]) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
540 | return ERR |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
541 | argv = argv[1:] |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
542 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
543 | ok, options, args = parser.parse_args_ok(argv) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
544 | if not ok: |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
545 | return ERR |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
546 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
547 | # Handle help and version. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
548 | if self.do_help(options, args, parser): |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
549 | return OK |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
550 | |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
551 | # Listify the list options. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
552 | source = unshell_list(options.source) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
553 | omit = unshell_list(options.omit) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
554 | include = unshell_list(options.include) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
555 | debug = unshell_list(options.debug) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
556 | contexts = unshell_list(options.contexts) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
557 | |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
558 | # Do something. |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
559 | self.coverage = Coverage( |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
560 | data_suffix=options.parallel_mode, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
561 | cover_pylib=options.pylib, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
562 | timid=options.timid, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
563 | branch=options.branch, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
564 | config_file=options.rcfile, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
565 | source=source, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
566 | omit=omit, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
567 | include=include, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
568 | debug=debug, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
569 | concurrency=options.concurrency, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
570 | check_preimported=True, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
571 | context=options.context, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
572 | ) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
573 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
574 | if options.action == "debug": |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
575 | return self.do_debug(args) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
576 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
577 | elif options.action == "erase": |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
578 | self.coverage.erase() |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
579 | return OK |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
580 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
581 | elif options.action == "run": |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
582 | return self.do_run(options, args) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
583 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
584 | elif options.action == "combine": |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
585 | if options.append: |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
586 | self.coverage.load() |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
587 | data_dirs = args or None |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
588 | self.coverage.combine(data_dirs, strict=True) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
589 | self.coverage.save() |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
590 | return OK |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
591 | |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
592 | # Remaining actions are reporting, with some common options. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
593 | report_args = dict( |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
594 | morfs=unglob_args(args), |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
595 | ignore_errors=options.ignore_errors, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
596 | omit=omit, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
597 | include=include, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
598 | contexts=contexts, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
599 | ) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
600 | |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
601 | # We need to be able to import from the current directory, because |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
602 | # plugins may try to, for example, to read Django settings. |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
603 | sys.path.insert(0, '') |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
604 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
605 | self.coverage.load() |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
606 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
607 | total = None |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
608 | if options.action == "report": |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
609 | total = self.coverage.report( |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
610 | show_missing=options.show_missing, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
611 | skip_covered=options.skip_covered, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
612 | skip_empty=options.skip_empty, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
613 | precision=options.precision, |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
614 | sort=options.sort, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
615 | **report_args |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
616 | ) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
617 | elif options.action == "annotate": |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
618 | self.coverage.annotate(directory=options.directory, **report_args) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
619 | elif options.action == "html": |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
620 | total = self.coverage.html_report( |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
621 | directory=options.directory, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
622 | title=options.title, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
623 | skip_covered=options.skip_covered, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
624 | skip_empty=options.skip_empty, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
625 | show_contexts=options.show_contexts, |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
626 | precision=options.precision, |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
627 | **report_args |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
628 | ) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
629 | elif options.action == "xml": |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
630 | outfile = options.outfile |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
631 | total = self.coverage.xml_report( |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
632 | outfile=outfile, skip_empty=options.skip_empty, |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
633 | **report_args |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
634 | ) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
635 | elif options.action == "json": |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
636 | outfile = options.outfile |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
637 | total = self.coverage.json_report( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
638 | outfile=outfile, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
639 | pretty_print=options.pretty_print, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
640 | show_contexts=options.show_contexts, |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
641 | **report_args |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
642 | ) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
643 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
644 | if total is not None: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
645 | # Apply the command line fail-under options, and then use the config |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
646 | # value, so we can get fail_under from the config file. |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
647 | if options.fail_under is not None: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
648 | self.coverage.set_option("report:fail_under", options.fail_under) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
649 | |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
650 | fail_under = self.coverage.get_option("report:fail_under") |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
651 | precision = self.coverage.get_option("report:precision") |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
652 | if should_fail_under(total, fail_under, precision): |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
653 | msg = "total of {total:.{p}f} is less than fail-under={fail_under:.{p}f}".format( |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
654 | total=total, fail_under=fail_under, p=precision, |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
655 | ) |
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
656 | print("Coverage failure:", msg) |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
657 | return FAIL_UNDER |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
658 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
659 | return OK |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
660 | |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
661 | def do_help(self, options, args, parser): |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
662 | """Deal with help requests. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
663 | |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
664 | Return True if it handled the request, False if not. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
665 | |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
666 | """ |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
667 | # Handle help. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
668 | if options.help: |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
669 | if self.global_option: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
670 | show_help(topic='help') |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
671 | else: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
672 | show_help(parser=parser) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
673 | return True |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
674 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
675 | if options.action == "help": |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
676 | if args: |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
677 | for a in args: |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
678 | parser = CMDS.get(a) |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
679 | if parser: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
680 | show_help(parser=parser) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
681 | else: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
682 | show_help(topic=a) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
683 | else: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
684 | show_help(topic='help') |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
685 | return True |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
686 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
687 | # Handle version. |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
688 | if options.version: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
689 | show_help(topic='version') |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
690 | return True |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
691 | |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
692 | return False |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
693 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
694 | def do_run(self, options, args): |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
695 | """Implementation of 'coverage run'.""" |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
696 | |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
697 | if not args: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
698 | if options.module: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
699 | # Specified -m with nothing else. |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
700 | show_help("No module specified for -m") |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
701 | return ERR |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
702 | command_line = self.coverage.get_option("run:command_line") |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
703 | if command_line is not None: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
704 | args = shlex.split(command_line) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
705 | if args and args[0] == "-m": |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
706 | options.module = True |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
707 | args = args[1:] |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
708 | if not args: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
709 | show_help("Nothing to do.") |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
710 | return ERR |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
711 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
712 | if options.append and self.coverage.get_option("run:parallel"): |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
713 | show_help("Can't append to data files in parallel mode.") |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
714 | return ERR |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
715 | |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
716 | if options.concurrency == "multiprocessing": |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
717 | # Can't set other run-affecting command line options with |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
718 | # multiprocessing. |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
719 | for opt_name in ['branch', 'include', 'omit', 'pylib', 'source', 'timid']: |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
720 | # As it happens, all of these options have no default, meaning |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
721 | # they will be None if they have not been specified. |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
722 | if getattr(options, opt_name) is not None: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
723 | show_help( |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
724 | "Options affecting multiprocessing must only be specified " |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
725 | "in a configuration file.\n" |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
726 | "Remove --{} from the command line.".format(opt_name) |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
727 | ) |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
728 | return ERR |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
729 | |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
730 | runner = PyRunner(args, as_module=bool(options.module)) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
731 | runner.prepare() |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
732 | |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
733 | if options.append: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
734 | self.coverage.load() |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
735 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
736 | # Run the script. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
737 | self.coverage.start() |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
738 | code_ran = True |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
739 | try: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
740 | runner.run() |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
741 | except NoSource: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
742 | code_ran = False |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
743 | raise |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
744 | finally: |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
745 | self.coverage.stop() |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
746 | if code_ran: |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
747 | self.coverage.save() |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
748 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
749 | return OK |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
750 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
751 | def do_debug(self, args): |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
752 | """Implementation of 'coverage debug'.""" |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
753 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
754 | if not args: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
755 | show_help("What information would you like: config, data, sys, premain?") |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
756 | return ERR |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
757 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
758 | for info in args: |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
759 | if info == 'sys': |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
760 | sys_info = self.coverage.sys_info() |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
761 | print(info_header("sys")) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
762 | for line in info_formatter(sys_info): |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
763 | print(" %s" % line) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
764 | elif info == 'data': |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
765 | self.coverage.load() |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
766 | data = self.coverage.get_data() |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
767 | print(info_header("data")) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
768 | print("path: %s" % self.coverage.get_data().data_filename()) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
769 | if data: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
770 | print("has_arcs: %r" % data.has_arcs()) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
771 | summary = line_counts(data, fullpath=True) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
772 | filenames = sorted(summary.keys()) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
773 | print("\n%d files:" % len(filenames)) |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
774 | for f in filenames: |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
775 | line = "%s: %d lines" % (f, summary[f]) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
776 | plugin = data.file_tracer(f) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
777 | if plugin: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
778 | line += " [%s]" % plugin |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
779 | print(line) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
780 | else: |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
781 | print("No data collected") |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
782 | elif info == 'config': |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
783 | print(info_header("config")) |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
784 | config_info = self.coverage.config.__dict__.items() |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
785 | for line in info_formatter(config_info): |
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
786 | print(" %s" % line) |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
787 | elif info == "premain": |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
788 | print(info_header("premain")) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
789 | print(short_stack()) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
790 | else: |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
791 | show_help("Don't know what you mean by %r" % info) |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
792 | return ERR |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
793 | |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
794 | return OK |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
795 | |
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
796 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
797 | def unshell_list(s): |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
798 | """Turn a command-line argument into a list.""" |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
799 | if not s: |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
800 | return None |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
801 | if env.WINDOWS: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
802 | # When running coverage.py as coverage.exe, some of the behavior |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
803 | # of the shell is emulated: wildcards are expanded into a list of |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
804 | # file names. So you have to single-quote patterns on the command |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
805 | # line, but (not) helpfully, the single quotes are included in the |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
806 | # argument, so we have to strip them off here. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
807 | s = s.strip("'") |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
808 | return s.split(',') |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
809 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
810 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
811 | def unglob_args(args): |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
812 | """Interpret shell wildcards for platforms that need it.""" |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
813 | if env.WINDOWS: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
814 | globbed = [] |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
815 | for arg in args: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
816 | if '?' in arg or '*' in arg: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
817 | globbed.extend(glob.glob(arg)) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
818 | else: |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
819 | globbed.append(arg) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
820 | args = globbed |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
821 | return args |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
824 | HELP_TOPICS = { |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
825 | 'help': """\ |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
826 | Coverage.py, version {__version__} {extension_modifier} |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
827 | Measure, collect, and report on code coverage in Python programs. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
828 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
829 | usage: {program_name} <command> [options] [args] |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
830 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
831 | Commands: |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
832 | annotate Annotate source files with execution information. |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
833 | combine Combine a number of data files. |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
834 | debug Display information about the internals of coverage.py |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
835 | erase Erase previously collected coverage data. |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
836 | help Get help on using coverage.py. |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
837 | html Create an HTML report. |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
838 | json Create a JSON report of coverage results. |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
839 | report Report coverage stats on modules. |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
840 | run Run a Python program and measure code execution. |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
841 | xml Create an XML report of coverage results. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
842 | |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
843 | Use "{program_name} help <command>" for detailed help on any command. |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
844 | """, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
845 | |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
846 | 'minimum_help': """\ |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
847 | Code coverage for Python, version {__version__} {extension_modifier}. Use '{program_name} help' for help. |
5051
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
848 | """, |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
849 | |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
850 | 'version': """\ |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
851 | Coverage.py, version {__version__} {extension_modifier} |
3586ebd9fac8
Updated coverage.py to version 4.1.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4489
diff
changeset
|
852 | """, |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
853 | } |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
854 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
855 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
856 | def main(argv=None): |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
857 | """The main entry point to coverage.py. |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
858 | |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
859 | This is installed as the script entry point. |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
860 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
861 | """ |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
862 | if argv is None: |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
863 | argv = sys.argv[1:] |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
864 | try: |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
865 | status = CoverageScript().command_line(argv) |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
866 | except ExceptionDuringRun as err: |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
867 | # An exception was caught while running the product code. The |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
868 | # sys.exc_info() return tuple is packed into an ExceptionDuringRun |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
869 | # exception. |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
870 | traceback.print_exception(*err.args) # pylint: disable=no-value-for-parameter |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
871 | status = ERR |
6219
d6c795b5ce33
Third Party, coverage: updated coverage.py to 4.5.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5178
diff
changeset
|
872 | except BaseCoverageException as err: |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
873 | # A controlled error inside coverage.py: print the message to the user. |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
874 | msg = err.args[0] |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
875 | if env.PY2: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
876 | msg = msg.encode(output_encoding()) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
877 | print(msg) |
29
391dc0bc4ae5
Updated coverage.py to version 3.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
878 | status = ERR |
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3495
diff
changeset
|
879 | except SystemExit as err: |
3495
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
880 | # The user called `sys.exit()`. Exit with their argument, if any. |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
881 | if err.args: |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
882 | status = err.args[0] |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
883 | else: |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
884 | status = None |
fac17a82b431
updated coverage to 3.7.1
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
29
diff
changeset
|
885 | return status |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
886 | |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
887 | # Profiling using ox_profile. Install it from GitHub: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
888 | # pip install git+https://github.com/emin63/ox_profile.git |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
889 | # |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
890 | # $set_env.py: COVERAGE_PROFILE - Set to use ox_profile. |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
891 | _profile = os.environ.get("COVERAGE_PROFILE", "") |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
892 | if _profile: # pragma: debugging |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
893 | from ox_profile.core.launchers import SimpleLauncher # pylint: disable=import-error |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
894 | original_main = main |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
895 | |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
896 | def main(argv=None): # pylint: disable=function-redefined |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
897 | """A wrapper around main that profiles.""" |
7702
f8b97639deb5
Third Party packages: updated coverage.py to 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7427
diff
changeset
|
898 | profiler = SimpleLauncher.launch() |
7427
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
899 | try: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
900 | return original_main(argv) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
901 | finally: |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
902 | data, _ = profiler.query(re_filter='coverage', max_records=100) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
903 | print(profiler.show(query=data, limit=100, sep='', col='')) |
362cd1b6f81a
coverage: updated coverage.py to 5.0.3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
904 | profiler.cancel() |