blob: 0b0bbdb357e727f38c91d940498dbff5461f191e (
plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# Copyright 2009-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import platform
from portage.tests import TestCase
from portage.util._pty import _can_test_pty_eof, _test_pty_eof
class PtyEofFdopenBufferedTestCase(TestCase):
def testPtyEofFdopenBuffered(self):
if not _can_test_pty_eof():
skip_reason = "unsupported on this platform"
self.portage_skip = skip_reason
self.fail(skip_reason)
return
# This tests if the following python issue is fixed yet:
# http://bugs.python.org/issue5380
# Since it might not be fixed, mark as todo.
self.todo = True
# The result is only valid if openpty does not raise EnvironmentError.
if _can_test_pty_eof():
try:
self.assertEqual(_test_pty_eof(fdopen_buffered=True), True)
except EnvironmentError:
pass
class PtyEofFdopenUnBufferedTestCase(TestCase):
def testPtyEofFdopenUnBuffered(self):
# New development: It appears that array.fromfile() is usable
# with python3 as long as fdopen is called with a bufsize
# argument of 0.
if not _can_test_pty_eof():
skip_reason = "unsupported on this platform"
self.portage_skip = skip_reason
self.fail(skip_reason)
return
if platform.python_implementation() == 'PyPy':
# https://bugs.pypy.org/issue956
self.todo = True
# The result is only valid if openpty does not raise EnvironmentError.
if _can_test_pty_eof():
try:
self.assertEqual(_test_pty_eof(), True)
except EnvironmentError:
pass
|