@@ -61,6 +61,10 @@ def parse_numprocesses(s):
61
61
62
62
@pytest .hookimpl
63
63
def pytest_addoption (parser ):
64
+ # 'Help' formatting (same rules as pytest's):
65
+ # Start with capitalized letters.
66
+ # If a single phrase, do not end with period. If more than one phrase, all phrases end with periods.
67
+ # Use \n to separate logical lines.
64
68
group = parser .getgroup ("xdist" , "distributed and subprocess testing" )
65
69
group ._addoption (
66
70
"-n" ,
@@ -69,25 +73,25 @@ def pytest_addoption(parser):
69
73
metavar = "numprocesses" ,
70
74
action = "store" ,
71
75
type = parse_numprocesses ,
72
- help = "Shortcut for '--dist=load --tx=NUM*popen'. With 'auto', attempt "
73
- "to detect physical CPU count. With 'logical', detect logical CPU "
74
- "count. If physical CPU count cannot be found , falls back to logical "
75
- "count. This will be 0 when used with --pdb." ,
76
+ help = "Shortcut for '--dist=load --tx=NUM*popen'.\n "
77
+ "With 'logical', attempt to detect logical CPU count (requires psutil, falls back to 'auto'). \n "
78
+ "With 'auto', attempt to detect physical CPU count. If physical CPU count cannot be determined , falls back to 1. \n "
79
+ "Forced to 0 (disabled) when used with --pdb." ,
76
80
)
77
81
group .addoption (
78
82
"--maxprocesses" ,
79
83
dest = "maxprocesses" ,
80
84
metavar = "maxprocesses" ,
81
85
action = "store" ,
82
86
type = int ,
83
- help = "limit the maximum number of workers to process the tests when using --numprocesses= auto" ,
87
+ help = "Limit the maximum number of workers to process the tests when using --numprocesses with ' auto' or 'logical' " ,
84
88
)
85
89
group .addoption (
86
90
"--max-worker-restart" ,
87
91
action = "store" ,
88
92
default = None ,
89
93
dest = "maxworkerrestart" ,
90
- help = "maximum number of workers that can be restarted "
94
+ help = "Maximum number of workers that can be restarted "
91
95
"when crashed (set to zero to disable this feature)" ,
92
96
)
93
97
group .addoption (
@@ -106,18 +110,18 @@ def pytest_addoption(parser):
106
110
dest = "dist" ,
107
111
default = "no" ,
108
112
help = (
109
- "set mode for distributing tests to exec environments.\n \n "
110
- "each: send each test to all available environments.\n \n "
111
- "load: load balance by sending any pending test to any"
113
+ "Set mode for distributing tests to exec environments.\n \n "
114
+ "each: Send each test to all available environments.\n \n "
115
+ "load: Load balance by sending any pending test to any"
112
116
" available environment.\n \n "
113
- "loadscope: load balance by sending pending groups of tests in"
117
+ "loadscope: Load balance by sending pending groups of tests in"
114
118
" the same scope to any available environment.\n \n "
115
- "loadfile: load balance by sending test grouped by file"
119
+ "loadfile: Load balance by sending test grouped by file"
116
120
" to any available environment.\n \n "
117
- "loadgroup: like load, but sends tests marked with 'xdist_group' to the same worker.\n \n "
118
- "worksteal: split the test suite between available environments,"
119
- " then rebalance when any worker runs out of tests.\n \n "
120
- "(default) no: run tests inprocess, don't distribute."
121
+ "loadgroup: Like ' load' , but sends tests marked with 'xdist_group' to the same worker.\n \n "
122
+ "worksteal: Split the test suite between available environments,"
123
+ " then re-balance when any worker runs out of tests.\n \n "
124
+ "(default) no: Run tests inprocess, don't distribute."
121
125
),
122
126
)
123
127
group .addoption (
@@ -127,8 +131,8 @@ def pytest_addoption(parser):
127
131
default = [],
128
132
metavar = "xspec" ,
129
133
help = (
130
- "add a test execution environment. some examples: "
131
- "--tx popen//python=python2.5 --tx socket=192.168.1.102:8888 "
134
+ "Add a test execution environment. Some examples:\n "
135
+ "--tx popen//python=python2.5 --tx socket=192.168.1.102:8888\n "
132
136
"--tx [email protected] //chdir=testcache"
133
137
),
134
138
)
@@ -137,29 +141,29 @@ def pytest_addoption(parser):
137
141
action = "store_true" ,
138
142
dest = "distload" ,
139
143
default = False ,
140
- help = "load -balance tests. shortcut for '--dist=load'" ,
144
+ help = "Load -balance tests. Shortcut for '--dist=load'. " ,
141
145
)
142
146
group .addoption (
143
147
"--rsyncdir" ,
144
148
action = "append" ,
145
149
default = [],
146
150
metavar = "DIR" ,
147
- help = "add directory for rsyncing to remote tx nodes. " ,
151
+ help = "Add directory for rsyncing to remote tx nodes" ,
148
152
)
149
153
group .addoption (
150
154
"--rsyncignore" ,
151
155
action = "append" ,
152
156
default = [],
153
157
metavar = "GLOB" ,
154
- help = "add expression for ignores when rsyncing to remote tx nodes. " ,
158
+ help = "Add expression for ignores when rsyncing to remote tx nodes" ,
155
159
)
156
160
group .addoption (
157
161
"--testrunuid" ,
158
162
action = "store" ,
159
163
help = (
160
- "provide an identifier shared amongst all workers as the value of "
161
- "the 'testrun_uid' fixture, \n \n , "
162
- "if not provided, 'testrun_uid' is filled with a new unique string "
164
+ "Provide an identifier shared amongst all workers as the value of "
165
+ "the 'testrun_uid' fixture. \n "
166
+ "If not provided, 'testrun_uid' is filled with a new unique string "
163
167
"on every test run."
164
168
),
165
169
)
@@ -168,13 +172,13 @@ def pytest_addoption(parser):
168
172
action = "store" ,
169
173
type = int ,
170
174
help = (
171
- "Maximum number of tests scheduled in one step for --dist=load. "
175
+ "Maximum number of tests scheduled in one step for --dist=load.\n "
172
176
"Setting it to 1 will force pytest to send tests to workers one by "
173
- "one - might be useful for a small number of slow tests. "
177
+ "one - might be useful for a small number of slow tests.\n "
174
178
"Larger numbers will allow the scheduler to submit consecutive "
175
- "chunks of tests to workers - allows reusing fixtures. "
179
+ "chunks of tests to workers - allows reusing fixtures.\n "
176
180
"Due to implementation reasons, at least 2 tests are scheduled per "
177
- "worker at the start. Only later tests can be scheduled one by one. "
181
+ "worker at the start. Only later tests can be scheduled one by one.\n "
178
182
"Unlimited if not set."
179
183
),
180
184
)
0 commit comments