| OLD | NEW |
| 1 import asyncore
| 1 import asyncore
|
| 2 import unittest
| 2 import unittest
|
| 3 import select
| 3 import select
|
| 4 import os
| 4 import os
|
| 5 import socket
| 5 import socket
|
| 6 import threading
| 6 import threading
|
| 7 import sys
| 7 import sys
|
| 8 import time
| 8 import time
|
| 9
| 9
|
| 10 from test import test_support
| 10 from test import test_support
|
| 11 from test.test_support import TESTFN, run_unittest, unlink
| 11 from test.test_support import TESTFN, run_unittest, unlink
|
| 12 from StringIO import StringIO
| 12 from StringIO import StringIO
|
| 13
| 13
|
| 14 HOST = test_support.HOST
| 14 HOST = test_support.HOST
|
| 15
| 15
|
| 16 class dummysocket:
| 16 class dummysocket:
|
| 17 def __init__(self):
| 17 def __init__(self):
|
| 18 self.closed = False
| 18 self.closed = False
|
| 19
| 19
|
| 20 def close(self):
| 20 def close(self):
|
| 21 self.closed = True
| 21 self.closed = True
|
| 22
| 22
|
| 23 def fileno(self):
| 23 def fileno(self):
|
| 24 return 42
| 24 return 42
|
| 25
| 25
|
| 26 class dummychannel:
| 26 class dummychannel:
|
| 27 def __init__(self):
| 27 def __init__(self):
|
| 28 self.socket = dummysocket()
| 28 self.socket = dummysocket()
|
| 29
|
| 30 def close(self):
|
| 31 self.socket.close()
|
| 29
| 32
|
| 30 class exitingdummy:
| 33 class exitingdummy:
|
| 31 def __init__(self):
| 34 def __init__(self):
|
| 32 pass
| 35 pass
|
| 33
| 36
|
| 34 def handle_read_event(self):
| 37 def handle_read_event(self):
|
| 35 raise asyncore.ExitNow()
| 38 raise asyncore.ExitNow()
|
| 36
| 39
|
| 37 handle_write_event = handle_read_event
| 40 handle_write_event = handle_read_event
|
| 38 handle_expt_event = handle_read_event
| 41 handle_expt_event = handle_read_event
|
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 def test_main():
| 406 def test_main():
|
| 404 tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests,
| 407 tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests,
|
| 405 DispatcherWithSendTests_UsePoll]
| 408 DispatcherWithSendTests_UsePoll]
|
| 406 if hasattr(asyncore, 'file_wrapper'):
| 409 if hasattr(asyncore, 'file_wrapper'):
|
| 407 tests.append(FileWrapperTest)
| 410 tests.append(FileWrapperTest)
|
| 408
| 411
|
| 409 run_unittest(*tests)
| 412 run_unittest(*tests)
|
| 410
| 413
|
| 411 if __name__ == "__main__":
| 414 if __name__ == "__main__":
|
| 412 test_main()
| 415 test_main()
|
| OLD | NEW |