@@ -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,27 @@ 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, "
79
+ "falls back to 1.\n "
80
+ "Forced to 0 (disabled) when used with --pdb." ,
76
81
)
77
82
group .addoption (
78
83
"--maxprocesses" ,
79
84
dest = "maxprocesses" ,
80
85
metavar = "maxprocesses" ,
81
86
action = "store" ,
82
87
type = int ,
83
- help = "limit the maximum number of workers to process the tests when using --numprocesses=auto" ,
88
+ help = "Limit the maximum number of workers to process the tests when using --numprocesses "
89
+ "with 'auto' or 'logical'" ,
84
90
)
85
91
group .addoption (
86
92
"--max-worker-restart" ,
87
93
action = "store" ,
88
94
default = None ,
89
95
dest = "maxworkerrestart" ,
90
- help = "maximum number of workers that can be restarted "
96
+ help = "Maximum number of workers that can be restarted "
91
97
"when crashed (set to zero to disable this feature)" ,
92
98
)
93
99
group .addoption (
@@ -106,18 +112,18 @@ def pytest_addoption(parser):
106
112
dest = "dist" ,
107
113
default = "no" ,
108
114
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"
115
+ "Set mode for distributing tests to exec environments.\n \n "
116
+ "each: Send each test to all available environments.\n \n "
117
+ "load: Load balance by sending any pending test to any"
112
118
" available environment.\n \n "
113
- "loadscope: load balance by sending pending groups of tests in"
119
+ "loadscope: Load balance by sending pending groups of tests in"
114
120
" the same scope to any available environment.\n \n "
115
- "loadfile: load balance by sending test grouped by file"
121
+ "loadfile: Load balance by sending test grouped by file"
116
122
" 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."
123
+ "loadgroup: Like ' load' , but sends tests marked with 'xdist_group' to the same worker.\n \n "
124
+ "worksteal: Split the test suite between available environments,"
125
+ " then re-balance when any worker runs out of tests.\n \n "
126
+ "(default) no: Run tests inprocess, don't distribute."
121
127
),
122
128
)
123
129
group .addoption (
@@ -127,8 +133,8 @@ def pytest_addoption(parser):
127
133
default = [],
128
134
metavar = "xspec" ,
129
135
help = (
130
- "add a test execution environment. some examples: "
131
- "--tx popen//python=python2.5 --tx socket=192.168.1.102:8888 "
136
+ "Add a test execution environment. Some examples:\n "
137
+ "--tx popen//python=python2.5 --tx socket=192.168.1.102:8888\n "
132
138
"--tx ssh=user@codespeak.net//chdir=testcache"
133
139
),
134
140
)
@@ -137,29 +143,29 @@ def pytest_addoption(parser):
137
143
action = "store_true" ,
138
144
dest = "distload" ,
139
145
default = False ,
140
- help = "load -balance tests. shortcut for '--dist=load'" ,
146
+ help = "Load -balance tests. Shortcut for '--dist=load'. " ,
141
147
)
142
148
group .addoption (
143
149
"--rsyncdir" ,
144
150
action = "append" ,
145
151
default = [],
146
152
metavar = "DIR" ,
147
- help = "add directory for rsyncing to remote tx nodes. " ,
153
+ help = "Add directory for rsyncing to remote tx nodes" ,
148
154
)
149
155
group .addoption (
150
156
"--rsyncignore" ,
151
157
action = "append" ,
152
158
default = [],
153
159
metavar = "GLOB" ,
154
- help = "add expression for ignores when rsyncing to remote tx nodes. " ,
160
+ help = "Add expression for ignores when rsyncing to remote tx nodes" ,
155
161
)
156
162
group .addoption (
157
163
"--testrunuid" ,
158
164
action = "store" ,
159
165
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 "
166
+ "Provide an identifier shared amongst all workers as the value of "
167
+ "the 'testrun_uid' fixture. \n "
168
+ "If not provided, 'testrun_uid' is filled with a new unique string "
163
169
"on every test run."
164
170
),
165
171
)
@@ -168,13 +174,13 @@ def pytest_addoption(parser):
168
174
action = "store" ,
169
175
type = int ,
170
176
help = (
171
- "Maximum number of tests scheduled in one step for --dist=load. "
177
+ "Maximum number of tests scheduled in one step for --dist=load.\n "
172
178
"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. "
179
+ "one - might be useful for a small number of slow tests.\n "
174
180
"Larger numbers will allow the scheduler to submit consecutive "
175
- "chunks of tests to workers - allows reusing fixtures. "
181
+ "chunks of tests to workers - allows reusing fixtures.\n "
176
182
"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. "
183
+ "worker at the start. Only later tests can be scheduled one by one.\n "
178
184
"Unlimited if not set."
179
185
),
180
186
)
0 commit comments