MCPcopy Index your code
hub / github.com/python/cpython / testSend

Method testSend

Lib/test/test_smtplib.py:378–395  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

376 smtp.quit()
377
378 def testSend(self):
379 # connect and send mail
380 m = 'A test message'
381 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
382 timeout=support.LOOPBACK_TIMEOUT)
383 self.addCleanup(smtp.close)
384 smtp.sendmail('John', 'Sally', m)
385 # XXX(nnorwitz): this test is flaky and dies with a bad file descriptor
386 # in asyncore. This sleep might help, but should really be fixed
387 # properly by using an Event variable.
388 time.sleep(0.01)
389 smtp.quit()
390
391 self.client_evt.set()
392 self.serv_evt.wait()
393 self.output.flush()
394 mexpect = '%s%s\n%s' % (MSG_BEGIN, m, MSG_END)
395 self.assertEqual(self.output.getvalue(), mexpect)
396
397 def testSendBinary(self):
398 m = b'A test message'

Callers

nothing calls this directly

Calls 9

sendmailMethod · 0.95
quitMethod · 0.95
addCleanupMethod · 0.80
sleepMethod · 0.45
setMethod · 0.45
waitMethod · 0.45
flushMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected