From a537485b1eba0de130a882eca9ce1daec5f8eaa2 Mon Sep 17 00:00:00 2001 From: JacobPEvans <20714140+JacobPEvans-personal@users.noreply.github.com> Date: Wed, 5 Aug 2026 09:03:33 -0400 Subject: [PATCH] chore: derive CliRunner kwargs from the Click signature - tests/conftest.py: pass mix_stderr only when the installed Click's CliRunner.__init__ still accepts it, checked via inspect.signature. This removes the type suppression and the try/except probe. - .pre-commit-config.yaml: the header now names the local gate job in .github/workflows/ci.yml as the CI consumer of this hook set; the _python-ci.yml reusable workflow is no longer referenced. Assisted-by: Claude:claude-fable-5 Claude-Session: https://claude.ai/code/session_01XKKV4NY5UNfrgXxXv83jvT --- .pre-commit-config.yaml | 4 ++-- tests/conftest.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c791c3..03a43af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,8 +18,8 @@ # so pyproject.toml dev-deps are the SINGLE version authority — no rev # pin to drift against. # -# CI runs this same hook set via the dryvist `_python-ci.yml` reusable workflow -# (see .github/workflows/ci.yml). zizmor is NOT here: it runs CENTRALLY via +# CI runs this same hook set directly: the `gate` job in +# .github/workflows/ci.yml. zizmor is NOT here: it runs CENTRALLY via # `_zizmor.yml` against dryvist/.github's canonical zizmor.yml (zero-copy — # this repo no longer carries a zizmor.yml). --- diff --git a/tests/conftest.py b/tests/conftest.py index efde0c1..c6feb0b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,8 @@ from __future__ import annotations +import inspect from collections.abc import Callable +from typing import Any import httpx import pytest @@ -16,13 +18,13 @@ def cli_runner() -> CliRunner: Click below 8.2 folds stderr into stdout unless asked not to, so reading ``result.stderr`` raises. Click 8.2 removed the parameter and always - separates. Ask for separation, and fall back when the parameter is gone. - Only tests that assert on stderr need this. + separates. Ask for separation only when the installed Click still takes + the parameter. Only tests that assert on stderr need this. """ - try: - return CliRunner(mix_stderr=False) # type: ignore[call-arg] - except TypeError: - return CliRunner() + kwargs: dict[str, Any] = {} + if "mix_stderr" in inspect.signature(CliRunner.__init__).parameters: + kwargs["mix_stderr"] = False + return CliRunner(**kwargs) def make_client(handler: Callable, *, dry_run: bool = False) -> SplunkClient: