diff --git a/mayan/apps/common/tests/utils.py b/mayan/apps/common/tests/utils.py new file mode 100644 index 0000000000..e6702dc09f --- /dev/null +++ b/mayan/apps/common/tests/utils.py @@ -0,0 +1,16 @@ +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 +