feat: add context manager to suppress print from e.g. macros
CI / lint (pull_request) Successful in 23s
CI / test (3.11) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 24s
CI / test (3.13) (pull_request) Successful in 23s
CI / lint (push) Canceled after 10s
CI / test (3.11) (push) Canceled after 0s
CI / test (3.12) (push) Canceled after 0s
CI / test (3.13) (push) Canceled after 0s
Build and Publish / release (push) Successful in 10s

This commit was merged in pull request #34.
This commit is contained in:
2026-09-09 17:05:59 +02:00
committed by David Perl
parent 39d7ae8dd3
commit f990ac4679
+9
View File
@@ -0,0 +1,9 @@
import os
from contextlib import contextmanager, redirect_stderr, redirect_stdout
@contextmanager
def suppress_output():
"""Suppress both stdout and stderr by redirecting them to os.devnull."""
with open(os.devnull, "w") as fnull, redirect_stdout(fnull), redirect_stderr(fnull):
yield