feat: add context manager to suppress print from e.g. macros
CI / lint (push) Failing after 21s
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped

This commit is contained in:
2026-07-13 10:52:52 +02:00
parent 6b2bbd17e3
commit 32ac7ca6f5
+11
View File
@@ -0,0 +1,11 @@
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:
with redirect_stdout(fnull), redirect_stderr(fnull):
yield