Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(169842)

Side by Side Diff: Lib/test/test_kqueue.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_json/test_decode.py ('k') | Lib/test/test_logging.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """ 1 """
2 Tests for kqueue wrapper. 2 Tests for kqueue wrapper.
3 """ 3 """
4 import errno 4 import errno
5 import os 5 import os
6 import select 6 import select
7 import socket 7 import socket
8 import sys 8 import sys
9 import time 9 import time
10 import unittest 10 import unittest
11 11
12 from test import support 12 from test import support
13 if not hasattr(select, "kqueue"): 13 if not hasattr(select, "kqueue"):
14 raise unittest.SkipTest("test works only on BSD") 14 raise unittest.SkipTest("test works only on BSD")
15 15
16 class TestKQueue(unittest.TestCase): 16 class TestKQueue(unittest.TestCase):
17 def test_create_queue(self): 17 def test_create_queue(self):
18 kq = select.kqueue() 18 kq = select.kqueue()
19 self.assertTrue(kq.fileno() > 0, kq.fileno()) 19 self.assertGreater(kq.fileno(), 0)
20 self.assertTrue(not kq.closed) 20 self.assertFalse(kq.closed)
21 kq.close() 21 kq.close()
22 self.assertTrue(kq.closed) 22 self.assertTrue(kq.closed)
23 self.assertRaises(ValueError, kq.fileno) 23 self.assertRaises(ValueError, kq.fileno)
24 24
25 def test_create_event(self): 25 def test_create_event(self):
26 from operator import lt, le, gt, ge 26 from operator import lt, le, gt, ge
27 27
28 fd = os.open(os.devnull, os.O_WRONLY) 28 fd = os.open(os.devnull, os.O_WRONLY)
29 self.addCleanup(os.close, fd) 29 self.addCleanup(os.close, fd)
30 30
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 kqueue = select.kqueue() 210 kqueue = select.kqueue()
211 self.addCleanup(kqueue.close) 211 self.addCleanup(kqueue.close)
212 self.assertEqual(os.get_inheritable(kqueue.fileno()), False) 212 self.assertEqual(os.get_inheritable(kqueue.fileno()), False)
213 213
214 214
215 def test_main(): 215 def test_main():
216 support.run_unittest(TestKQueue) 216 support.run_unittest(TestKQueue)
217 217
218 if __name__ == "__main__": 218 if __name__ == "__main__":
219 test_main() 219 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_json/test_decode.py ('k') | Lib/test/test_logging.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+