summaryrefslogtreecommitdiffstats
path: root/tests/test_helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_helper.py')
-rw-r--r--tests/test_helper.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_helper.py b/tests/test_helper.py
new file mode 100644
index 0000000..03b7e97
--- /dev/null
+++ b/tests/test_helper.py
@@ -0,0 +1,16 @@
+import sys
+from codecs import StreamReader
+from io import StringIO
+from typing import Optional, TextIO, Union
+
+stdout: Optional[Union[TextIO, StreamReader]] = None
+
+
+class Test:
+ def setUp(self) -> None:
+ global stdout # pylint: disable=global-statement
+ self.real_stdout = sys.stdout
+ sys.stdout = stdout = StringIO()
+
+ def tearDown(self) -> None:
+ sys.stdout = self.real_stdout