Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-81002: Add tests for termios #110386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 10, 2023
Merged
Prev Previous commit
Next Next commit
Only open files once.
  • Loading branch information
serhiy-storchaka committed Oct 5, 2023
commit cfa146f47dc7f106861042e46660411008d2dd29
15 changes: 8 additions & 7 deletions 15 Lib/test/test_termios.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@

class TestFunctions(unittest.TestCase):

def setUp(self):
@classmethod
def setUpClass(cls):
serhiy-storchaka marked this conversation as resolved.
Show resolved Hide resolved
try:
self.stream = open('/dev/tty', 'wb', buffering=0)
cls.stream = open('/dev/tty', 'wb', buffering=0)
except OSError:
self.skipTest("Cannot open '/dev/tty'")
self.addCleanup(self.stream.close)
self.fd = self.stream.fileno()
self.bad_fd, _ = tempfile.mkstemp()
self.addClassCleanup(os.close, self.bad_fd)
raise unittest.SkipTest("Cannot open '/dev/tty'")
cls.addClassCleanup(cls.stream.close)
cls.fd = cls.stream.fileno()
cls.bad_fd, _ = tempfile.mkstemp()
cls.addClassCleanup(os.close, cls.bad_fd)

def assertRaisesTermiosError(self, errno, callable, *args):
with self.assertRaises(termios.error) as cm:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.