MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / tests_status

Function tests_status

unity_cli/cli/commands/tests.py:229–269  ·  view source on GitHub ↗

Check whether a test run is in progress and its pass/fail counts. Pairs with 'u tests run --no-wait' for asynchronous CI-style workflows.

(
    ctx: typer.Context,
    json_flag: Annotated[
        bool,
        typer.Option("--json", help="Output as JSON"),
    ] = False,
)

Source from the content-addressed store, hash-verified

227
228@tests_app.command("status")
229def tests_status(
230 ctx: typer.Context,
231 json_flag: Annotated[
232 bool,
233 typer.Option("--json", help="Output as JSON"),
234 ] = False,
235) -> None:
236 """Check whether a test run is in progress and its pass/fail counts.
237
238 Pairs with 'u tests run --no-wait' for asynchronous CI-style workflows.
239 """
240 context: CLIContext = ctx.obj
241 try:
242 result = context.client.tests.status()
243 if _should_json(context, json_flag):
244 print_json(result, None)
245 elif is_no_color():
246 running = result.get("running", False)
247 kv: dict[str, Any] = {"status": "running" if running else "idle"}
248 if running:
249 started = result.get("testsStarted", 0)
250 finished = result.get("testsFinished", 0)
251 kv["progress"] = f"{finished}/{started}"
252 kv["passed"] = result.get("passed", 0)
253 kv["failed"] = result.get("failed", 0)
254 kv["skipped"] = result.get("skipped", 0)
255 print_key_value(kv)
256 else:
257 running = result.get("running", False)
258 status_text = "[green]running[/green]" if running else "[dim]idle[/dim]"
259 print_line(f"Tests: {status_text}")
260 if running:
261 passed = result.get("passed", 0)
262 failed = result.get("failed", 0)
263 skipped = result.get("skipped", 0)
264 started = result.get("testsStarted", 0)
265 finished = result.get("testsFinished", 0)
266 print_line(f" Progress: {finished}/{started}")
267 print_line(f" Passed: {passed} Failed: {failed} Skipped: {skipped}")
268 except UnityCLIError as e:
269 _handle_error(e)

Callers

nothing calls this directly

Calls 8

_should_jsonFunction · 0.90
print_jsonFunction · 0.90
is_no_colorFunction · 0.90
print_key_valueFunction · 0.90
print_lineFunction · 0.90
_handle_errorFunction · 0.90
statusMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected