File: stdio_test.py

package info (click to toggle)
python-mitogen 0.3.26-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,456 kB
  • sloc: python: 22,134; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (28 lines) | stat: -rw-r--r-- 899 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import testlib

import stdio_checks


class StdIOTest(testlib.RouterMixin, testlib.TestCase):
    """
    Test that stdin, stdout, and stderr conform to common expectations,
    such as blocking IO.
    """
    def test_can_write_stdout_1_mib(self):
        """
        Writing to stdout should not raise EAGAIN. Regression test for
        https://github.com/mitogen-hq/mitogen/issues/712.
        """
        size = 1 * 2**20
        context = self.router.local()
        result = context.call(stdio_checks.shout_stdout, size)
        self.assertEqual('success', result)

    def test_stdio_is_blocking(self):
        context = self.router.local()
        stdin_blocking, stdout_blocking, stderr_blocking = context.call(
            stdio_checks.stdio_is_blocking,
        )
        self.assertTrue(stdin_blocking)
        self.assertTrue(stdout_blocking)
        self.assertTrue(stderr_blocking)