From 513d4c60a11b9d671969331f857d6eaaaab96771 Mon Sep 17 00:00:00 2001 From: silveroxides Date: Fri, 2 Oct 2026 02:02:03 +0200 Subject: [PATCH] Make test runner quiet with failure-only ticker --- tests/conftest.py | 8 ++++++++ tests/run_tests.py | 30 +++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..fc31d37 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,8 @@ +def pytest_report_teststatus(report, config): + """Pytest hook: emit only 'F' for failed tests and nothing for passing/skipped tests.""" + if report.when in ("setup", "call") and report.failed: + return "failed", "F", "FAILED" + if report.passed: + return "passed", "", "" + if report.skipped: + return "skipped", "", "" diff --git a/tests/run_tests.py b/tests/run_tests.py index c6ec1f0..97ea794 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -172,11 +172,25 @@ def run_selection(selection: Selection) -> int: filter(None, (str(REPOSITORY_ROOT), environment.get("PYTHONPATH", ""))) ) result = subprocess.run( - [sys.executable, "-m", "pytest", "-q", "--import-mode=importlib", - "--basetemp", str(basetemp), - *[str((REPOSITORY_ROOT / path).resolve()) - for path in sorted(selection.python_tests)]], - cwd=COMFYUI_ROOT, env=environment, check=False, + [ + sys.executable, + "-m", + "pytest", + "-q", + "--import-mode=importlib", + "-o", + "addopts=", + "--capture=sys", + "--basetemp", + str(basetemp), + *[ + str((REPOSITORY_ROOT / path).resolve()) + for path in sorted(selection.python_tests) + ], + ], + cwd=COMFYUI_ROOT, + env=environment, + check=False, ) return result.returncode finally: @@ -222,11 +236,13 @@ def main(argv: list[str] | None = None) -> int: print(f" {path}", file=sys.stderr) print("Update tests/test_groups.toml or use --final.", file=sys.stderr) return 2 - print_selection(selection) + if args.dry_run: + print_selection(selection) + return 0 if not selection.python_tests: print("No tests selected.") return 0 - return 0 if args.dry_run else run_selection(selection) + return run_selection(selection) if __name__ == "__main__":