Fixed test to reflect new filedispatcher semantics, as well as two
NameErrors pointed out by Giampaolo.
This commit is contained in:
parent
1cec7aa7c7
commit
b67b53db51
|
@ -228,7 +228,7 @@ class dispatcher:
|
||||||
# passed be connected.
|
# passed be connected.
|
||||||
try:
|
try:
|
||||||
self.addr = sock.getpeername()
|
self.addr = sock.getpeername()
|
||||||
except socket.error:
|
except socket.error, err:
|
||||||
if err[0] == ENOTCONN:
|
if err[0] == ENOTCONN:
|
||||||
# To handle the case where we got an unconnected
|
# To handle the case where we got an unconnected
|
||||||
# socket.
|
# socket.
|
||||||
|
@ -424,7 +424,7 @@ class dispatcher:
|
||||||
#check for errors
|
#check for errors
|
||||||
err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
|
err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
|
||||||
if err != 0:
|
if err != 0:
|
||||||
raise socket.error(err, strerror(err))
|
raise socket.error(err, _strerror(err))
|
||||||
|
|
||||||
self.handle_connect_event()
|
self.handle_connect_event()
|
||||||
self.handle_write()
|
self.handle_write()
|
||||||
|
|
|
@ -384,8 +384,8 @@ if hasattr(asyncore, 'file_wrapper'):
|
||||||
fd = os.open(TESTFN, os.O_RDONLY)
|
fd = os.open(TESTFN, os.O_RDONLY)
|
||||||
w = asyncore.file_wrapper(fd)
|
w = asyncore.file_wrapper(fd)
|
||||||
|
|
||||||
self.assertEqual(w.fd, fd)
|
self.assertNotEqual(w.fd, fd)
|
||||||
self.assertEqual(w.fileno(), fd)
|
self.assertNotEqual(w.fileno(), fd)
|
||||||
self.assertEqual(w.recv(13), "It's not dead")
|
self.assertEqual(w.recv(13), "It's not dead")
|
||||||
self.assertEqual(w.read(6), ", it's")
|
self.assertEqual(w.read(6), ", it's")
|
||||||
w.close()
|
w.close()
|
||||||
|
|
Loading…
Reference in New Issue