feat: add context manager to suppress print from e.g. macros
CI / lint (push) Successful in 21s
CI / test (3.11) (push) Successful in 28s
CI / test (3.13) (push) Successful in 24s
CI / test (3.12) (push) Successful in 25s
CI / lint (pull_request) Successful in 16s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 21s
CI / test (3.13) (pull_request) Successful in 20s
CI / lint (push) Successful in 21s
CI / test (3.11) (push) Successful in 28s
CI / test (3.13) (push) Successful in 24s
CI / test (3.12) (push) Successful in 25s
CI / lint (pull_request) Successful in 16s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 21s
CI / test (3.13) (pull_request) Successful in 20s
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
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
|
||||
Reference in New Issue
Block a user