Committing Py3k version of changelist 64080 and 64257, along with updated tests
for smtpd, which required updating with the new semantics.
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index 082fde9..db0b194 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -105,8 +105,8 @@
time.sleep(0.01) # Give server time to start accepting.
c = echo_client(term, s.port)
c.push(b"hello ")
- c.push(bytes("world%s" % term, "ascii"))
- c.push(bytes("I'm not dead yet!%s" % term, "ascii"))
+ c.push(b"world" + term)
+ c.push(b"I'm not dead yet!" + term)
c.push(SERVER_QUIT)
asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
s.join()
@@ -120,17 +120,17 @@
def test_line_terminator1(self):
# test one-character terminator
for l in (1,2,3):
- self.line_terminator_check('\n', l)
+ self.line_terminator_check(b'\n', l)
def test_line_terminator2(self):
# test two-character terminator
for l in (1,2,3):
- self.line_terminator_check('\r\n', l)
+ self.line_terminator_check(b'\r\n', l)
def test_line_terminator3(self):
# test three-character terminator
for l in (1,2,3):
- self.line_terminator_check('qqq', l)
+ self.line_terminator_check(b'qqq', l)
def numeric_terminator_check(self, termlen):
# Try reading a fixed number of bytes
@@ -190,7 +190,7 @@
# checks that empty lines are handled correctly
s, event = start_echo_server()
c = echo_client(b'\n', s.port)
- c.push("hello world\n\nI'm not dead yet!\n")
+ c.push(b"hello world\n\nI'm not dead yet!\n")
c.push(SERVER_QUIT)
asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
s.join()
@@ -201,7 +201,7 @@
def test_close_when_done(self):
s, event = start_echo_server()
c = echo_client(b'\n', s.port)
- c.push("hello world\nI'm not dead yet!\n")
+ c.push(b"hello world\nI'm not dead yet!\n")
c.push(SERVER_QUIT)
c.close_when_done()
asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01)
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py
index eb52687..716368b 100644
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -28,6 +28,9 @@
def __init__(self):
self.socket = dummysocket()
+ def close(self):
+ self.socket.close()
+
class exitingdummy:
def __init__(self):
pass
@@ -382,8 +385,8 @@
fd = os.open(TESTFN, os.O_RDONLY)
w = asyncore.file_wrapper(fd)
- self.assertEqual(w.fd, fd)
- self.assertEqual(w.fileno(), fd)
+ self.assertNotEqual(w.fd, fd)
+ self.assertNotEqual(w.fileno(), fd)
self.assertEqual(w.recv(13), b"It's not dead")
self.assertEqual(w.read(6), b", it's")
w.close()
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index 3f3ba6b..6a94658 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -14,6 +14,14 @@
HOST = support.HOST
+if sys.platform == 'darwin':
+ # select.poll returns a select.POLLHUP at the end of the tests
+ # on darwin, so just ignore it
+ def handle_expt(self):
+ pass
+ smtpd.SMTPChannel.handle_expt = handle_expt
+
+
def server(evt, buf, serv):
serv.listen(5)
evt.set()