fe218b6fa97eb0f1d8aba5083383250ce95fda6a
[portage.git] / pym / portage / tests / ebuild / test_pty_eof.py
1 # Copyright 2009-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 from portage.tests import TestCase
5 from portage.util._pty import _can_test_pty_eof, _test_pty_eof
6
7 class PtyEofTestCase(TestCase):
8
9         def testPtyEof(self):
10
11                 if not _can_test_pty_eof():
12                         skip_reason = "unsupported on this platform"
13                         self.portage_skip = skip_reason
14                         self.fail(skip_reason)
15                         return
16
17                 # This tests if the following python issue is fixed yet:
18                 #   http://bugs.python.org/issue5380
19                 # Since it might not be fixed, mark as todo.
20                 self.todo = True
21                 # The result is only valid if openpty does not raise EnvironmentError.
22                 if _can_test_pty_eof():
23                         try:
24                                 self.assertEqual(_test_pty_eof(), True)
25                         except EnvironmentError:
26                                 pass