summaryrefslogtreecommitdiffstats
path: root/Lib/test/eintrdata
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/eintrdata')
-rw-r--r--Lib/test/eintrdata/eintr_tester.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py
index 40dca84..8547576 100644
--- a/Lib/test/eintrdata/eintr_tester.py
+++ b/Lib/test/eintrdata/eintr_tester.py
@@ -252,8 +252,23 @@ class SocketEINTRTest(EINTRBaseTest):
lambda path: os.close(os.open(path, os.O_WRONLY)))
+@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()")
+class TimeEINTRTest(EINTRBaseTest):
+ """ EINTR tests for the time module. """
+
+ def test_sleep(self):
+ t0 = time.monotonic()
+ time.sleep(2)
+ signal.alarm(0)
+ dt = time.monotonic() - t0
+ self.assertGreaterEqual(dt, 1.9)
+
+
def test_main():
- support.run_unittest(OSEINTRTest, SocketEINTRTest)
+ support.run_unittest(
+ OSEINTRTest,
+ SocketEINTRTest,
+ TimeEINTRTest)
if __name__ == "__main__":