climate_ref.cli.test_cases._common
#
Helpers shared across several ref test-cases commands.
VerbDriver owns the per-case loop machinery every verb repeats
(registry construction, selector validation, case enumeration, skip policy, tally and summary).
VerbCase
#
Bases: NamedTuple
A test case ready for a verb's loop body, with its paths resolved.
Source code in packages/climate-ref/src/climate_ref/cli/test_cases/_common.py
VerbDriver
#
Shared per-case driver for the ref test-cases verbs.
The loop body stays with the verb and reports via :meth:ok and :meth:fail.
Source code in packages/climate-ref/src/climate_ref/cli/test_cases/_common.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
exit_if_empty()
#
Exit 0 with a warning when the selectors matched no test cases.
Source code in packages/climate-ref/src/climate_ref/cli/test_cases/_common.py
fail(label, message=None)
#
Record a failure, logging message as an error when given.
label is the entry listed under the summary's failed header, usually the case id.
Source code in packages/climate-ref/src/climate_ref/cli/test_cases/_common.py
finish(summary)
#
Print the verb's summary and exit non-zero when any case failed.
Source code in packages/climate-ref/src/climate_ref/cli/test_cases/_common.py
ok()
#
ready_cases(*, require_manifest=False, require_catalog=False)
#
Yield the matched cases with paths resolved, applying the shared skip policy.
An unlocatable test-data directory or a missing manifest.json is a hard failure
when the case was named explicitly, and a warn-and-skip when sweeping.
A missing catalog is always a hard failure.
Skips and failures are recorded as the caller iterates, so the loop must run to exhaustion for the summary to see them all.
Source code in packages/climate-ref/src/climate_ref/cli/test_cases/_common.py
VerbSummary
#
Bases: NamedTuple
Summary for a per-case verb.
Source code in packages/climate-ref/src/climate_ref/cli/test_cases/_common.py
failed_header
instance-attribute
#
Red header above the failed case list, e.g. "Failed replays:".
mixed
instance-attribute
#
Yellow tally line when any case failed, e.g. "Replay: {successes} passed, {failures} failed".
success
instance-attribute
#
Green line when every case succeeded, e.g. "All {successes} replay(s) matched ...".