Files
mayan-edms/mayan/apps/common/tests/utils.py
Roberto Rosario 24304636d9 Add test util to mute output to stdout
Used by the tests of the autoadmin app.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2019-04-14 00:39:53 -04:00

17 lines
273 B
Python

from contextlib import contextmanager
import sys
class NullFile(object):
def write(self, string):
"""Writes here go nowhere"""
@contextmanager
def mute_stdout():
stdout_old = sys.stdout
sys.stdout = NullFile()
yield
sys.stdout = stdout_old