Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 1 | import os |
| 2 | import signal |
Victor Stinner | 4b35217 | 2015-09-18 11:29:16 +0200 | [diff] [blame] | 3 | import subprocess |
| 4 | import sys |
Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 5 | import unittest |
| 6 | |
Berker Peksag | ce64391 | 2015-05-06 06:33:17 +0300 | [diff] [blame] | 7 | from test import support |
| 8 | from test.support import script_helper |
Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 9 | |
| 10 | |
| 11 | @unittest.skipUnless(os.name == "posix", "only supported on Unix") |
| 12 | class EINTRTests(unittest.TestCase): |
| 13 | |
| 14 | @unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") |
| 15 | def test_all(self): |
| 16 | # Run the tester in a sub-process, to make sure there is only one |
| 17 | # thread (for reliable signal delivery). |
| 18 | tester = support.findfile("eintr_tester.py", subdir="eintrdata") |
Victor Stinner | 4b35217 | 2015-09-18 11:29:16 +0200 | [diff] [blame] | 19 | |
| 20 | if support.verbose: |
| 21 | args = [sys.executable, tester] |
| 22 | with subprocess.Popen(args) as proc: |
| 23 | exitcode = proc.wait() |
| 24 | self.assertEqual(exitcode, 0) |
| 25 | else: |
| 26 | script_helper.assert_python_ok(tester) |
Charles-François Natali | 6e6c59b | 2015-02-07 13:27:50 +0000 | [diff] [blame] | 27 | |
| 28 | |
| 29 | if __name__ == "__main__": |
| 30 | unittest.main() |