<commit_before>#!/usr/bin/env python
import pexpect
import unittest
import PexpectTestCase
import time
import sys

class TestCaseWinsize(PexpectTestCase.PexpectTestCase):

    def test_winsize (self):
        """
        This tests that the child process can set and get the windows size.
        This makes use of an external script sigwinch_report.py.
        """
        p1 = pexpect.spawn('%s sigwinch_report.py' % self.PYTHONBIN)
        time.sleep(10)
        p1.setwinsize (11,22)
        time.sleep(3)
        index = p1.expect ([pexpect.TIMEOUT, 'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], timeout=30)
        if index == 0:
            self.fail ("TIMEOUT -- this platform may not support sigwinch properly.\n" + str(p1))
        r = p1.match.group(1)
        c = p1.match.group(2)
        assert (r=="11" and c=="22")
        time.sleep(1)
        p1.setwinsize (24,80)
        index = p1.expect ([pexpect.TIMEOUT, 'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], timeout=10)
        if index == 0:
            self.fail ("TIMEOUT -- this platform may not support sigwinch properly.\n" + str(p1))
        r = p1.match.group(1)
        c = p1.match.group(2)
        assert (r=="24" and c=="80")
        p1.close()

if __name__ == '__main__':
    unittest.main()

suite = unittest.makeSuite(TestCaseWinsize,'test')

<commit_msg>Trying to make a test for EINTR in select(). Testing my own __select() wrapper.<commit_after>#!/usr/bin/env python
import pexpect
import unittest
import PexpectTestCase
import time
import sys

class TestCaseWinsize(PexpectTestCase.PexpectTestCase):

    def test_winsize (self):
        """
        This tests that the child process can set and get the windows size.
        This makes use of an external script sigwinch_report.py.
        """
        p1 = pexpect.spawn('%s sigwinch_report.py' % self.PYTHONBIN)
        time.sleep(10)
        p1.setwinsize (11,22)
        time.sleep(3)
        index = p1.expect ([pexpect.TIMEOUT, 'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], timeout=30)
        if index == 0:
            self.fail ("TIMEOUT -- this platform may not support sigwinch properly.\n" + str(p1))
        r = p1.match.group(1)
        c = p1.match.group(2)
        assert (r=="11" and c=="22")
        time.sleep(1)
        p1.setwinsize (24,80)
        index = p1.expect ([pexpect.TIMEOUT, 'SIGWINCH: \(([0-9]*), ([0-9]*)\)'], timeout=10)
        if index == 0:
            self.fail ("TIMEOUT -- this platform may not support sigwinch properly.\n" + str(p1))
        r = p1.match.group(1)
        c = p1.match.group(2)
        assert (r=="24" and c=="80")
        p1.close()

    def test_parent_resize (self):
        pid = os.getpid()
        p1 = pexpect.spawn('%s sigwinch_report.py' % self.PYTHONBIN)
        time.sleep(10)
        p1.setwinsize (11,22)
        os.kill (pid, signal.SIGINT)

if __name__ == '__main__':
    unittest.main()

suite = unittest.makeSuite(TestCaseWinsize,'test')



{'fraction_non_alphanumeric': 0.14808481532147744, 'fraction_numerical': 0.036935704514363885, 'mean_word_length': 2.4250585480093676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1336775', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1022, 'n_words': 252}