-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
cli-options.txt
171 lines (152 loc) · 9.15 KB
/
cli-options.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
usage: green [options] [target [target2 ...]]
Green is a clean, colorful, fast test runner for Python unit tests.
Target Specification:
target Targets to test. Any number of targets may be
specified. If blank, then discover all testcases in
the current directory tree. Can be a directory (or
package), file (or module), or fully-qualified 'dotted
name' like proj.tests.test_things.TestStuff. If a
directory (or package) is specified, then we will
attempt to discover all tests under the directory
(even if the directory is a package and the tests
would not be accessible through the package's scope).
In all other cases, only tests accessible from
introspection of the object will be loaded.
Concurrency Options:
-s NUM, --processes NUM
Number of processes to use to run tests. Note that
your tests need to be written to avoid using the same
resources (temp files, sockets, ports, etc.) for the
multi-process mode to work well (--initializer and
--finalizer can help provision per-process resources).
Default is to run the same number of processes as your
machine has logical CPUs. Note that for a small number
of trivial tests, running everything in a single
process may be faster than the overhead of
initializing all the processes.
-i DOTTED_FUNCTION, --initializer DOTTED_FUNCTION
Python function to run inside of a single worker
process before it starts running tests. This is the
way to provision external resources that each
concurrent worker process needs to have exclusive
access to. Specify the function in dotted notation in
a way that will be importable from the location you
are running green from.
-z DOTTED_FUNCTION, --finalizer DOTTED_FUNCTION
Same as --initializer, only run at the end of a worker
process's lifetime. Used to unprovision resources
provisioned by the initializer.
-X NUM, --maxtasksperchild NUM
Passed directly as the `maxtasksperchild` argument to
an internal `multiprocessing.pool.Pool`. A "task" in
this context usually corresponds to a test suite
consisting of all the tests in a single file. This
option slows down testing, but has the benefit of
guaranteeing a new Python process for each test suite.
Format Options:
-t, --termcolor Force terminal colors on. Default is to autodetect.
-T, --notermcolor Force terminal colors off. Default is to autodetect.
-W, --disable-windows
Disable Windows support by turning off Colorama
Output Options:
-a, --allow-stdout Instead of capturing the stdout and stderr and
presenting it in the summary of results, let it come
through. Note that output from sources other than
tests (like module/class setup or teardown) is never
captured.
-q, --quiet-stdout Instead of capturing the stdout and stderr and
presenting it in the summary of results, discard it
completly for successful tests. --allow-stdout option
overrides it.
-k, --no-skip-report Don't print the report of skipped tests after testing
is done. Skips will still show up in the progress
report and summary count.
-e, --no-tracebacks Don't print tracebacks for failures and errors.
-h, --help Show this help message and exit.
-V, --version Print the version of Green and Python and exit.
-l, --logging Don't configure the root logger to redirect to
/dev/null, enabling internal debugging output, as well
as any output test (or tested) code may be sending via
the root logger.
-d, --debug Enable internal debugging statements. Implies
--logging. Can be specified up to three times for more
debug output.
-v, --verbose Verbose. Can be specified up to three times for more
verbosity. Recommended levels are -v and -vv.
-U, --disable-unidecode
Disable unidecode which converts test output from
unicode toascii by default on Windows to avoid hard-
to-debug crashes.
Other Options:
-f, --failfast Stop execution at the first test that fails or errors.
-c FILE, --config FILE
Use this config file to override any values from the
config file specified by environment variable
GREEN_CONFIG, ~/.green, and .green in the current
working directory.
-p PATTERN, --file-pattern PATTERN
Pattern to match test files. Default is test*.py
-n PATTERN, --test-pattern PATTERN
Pattern to match test method names after 'test'.
Default is '*', meaning match methods named 'test*'.
-j FILENAME, --junit-report FILENAME
Generate a JUnit XML report.
Coverage Options (Coverage 6.4.4):
-r, --run-coverage Produce coverage output.
-g FILE, --cov-config-file FILE
Specify a coverage config file. Implies --run-coverage
See the coverage documentation at
https://coverage.readthedocs.io/en/v4.5.x/config.html
for coverage config file syntax. The [run] and
[report] sections are most relevant.
-R, --quiet-coverage Do not print coverage report to stdout (coverage files
will still be created). Implies --run-coverage
-O, --clear-omit Green tries really hard to set up a good list of
patterns of files to omit from coverage reports. If
the default list catches files that you DO want to
cover you can specify this flag to leave the default
list empty to start with. You can then add patterns
back in with --omit-patterns. The default list is
something like '*/test*,*/mock*,*(temp dir)*,*(python
system packages)*' -- only longer.
-u PATTERN, --include-patterns PATTERN
Comma-separated file-patterns to include in coverage.
This implies that anything that does not match the
include pattern is omitted from coverage reporting.
-o PATTERN, --omit-patterns PATTERN
Comma-separated file-patterns to omit from coverage.
For example, if coverage reported a file
mypackage/foo/bar you could omit it from coverage with
'mypackage*', '*/foo/*', or '*bar'
-m X, --minimum-coverage X
Integer. A minimum coverage value. If not met, then we
will print a message and exit with a nonzero status.
Implies --run-coverage
Integration Options:
--completion-file Location of the bash- and zsh-completion file. To
enable bash- or zsh-completion, see ENABLING SHELL
COMPLETION below.
--completions Output possible completions of the given target. Used
by bash- and zsh-completion.
--options Output all options. Used by bash- and zsh-completion.
ENABLING SHELL COMPLETION
To enable bash- or zsh-completion, add the line below to the end of your
.bashrc or .zshrc file (or equivalent config file):
which green >& /dev/null && source "$( green --completion-file )"
Warning! Generating a completion list actually discovers and loads tests
-- this can be very slow if you run it in huge directories!
SETUP.PY RUNNER
To run green as a setup.py command, simply add green to the 'setup_requires'
section in the setup.py file, and specify a target as the 'test_suite'
parameter if you do not want green to load all the tests:
setup(
setup_requires = ['green'],
install_requires = 'myproject.tests'
)
Then simply run green as any other setup.py command (it accepts the same
parameters as the 'green' executable):
python setup.py green
python setup.py green -r # to run with coverage, etc.
CONFIG FILES
For documentation on config files, please see
https://github.com/CleanCut/green#config-files