summaryrefslogtreecommitdiffstats
path: root/tests/test_helper.py
blob: 03b7e97f5d1ba29ba33cf87057cfe4fe537a2bc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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