Skip to content

Commit

Permalink
Use threading module instead of thread module.
Browse files Browse the repository at this point in the history
  • Loading branch information
montanaro committed Feb 23, 2009
1 parent ae03a4f commit f79745b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spambayes/spambayes/test/test_sb_imapfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import email
import types
import socket
import thread
import threading
import imaplib
import unittest
import asyncore
Expand Down Expand Up @@ -347,7 +347,6 @@ def testGoodLogin(self):
self.assert_(self.imap.logged_in)

def testBadLogin(self):
print "\nYou should see a message indicating that login failed."
self.assertRaises(LoginFailure, self.imap.login, IMAP_USERNAME,
"wrong password")

Expand Down Expand Up @@ -802,7 +801,9 @@ class InterfaceTest(unittest.TestCase):
def setUp(self):
self.saved_server = options["imap", "server"]
options["imap", "server"] = ""
thread.start_new_thread(run, (True,))
self._server = threading.Thread(target=run, args=(True,))
self._server.setDaemon(True)
self._server.start()
# Wait for it to be ready.
time.sleep(1)

Expand Down Expand Up @@ -843,5 +844,8 @@ def suite():
def runTestServer():
TestListener()
asyncore.loop()
thread.start_new_thread(runTestServer, ())
server = threading.Thread(target=runTestServer, args=())
server.setDaemon(True)
server.start()
time.sleep(2)
sb_test_support.unittest_main(argv=sys.argv + ['suite'])

0 comments on commit f79745b

Please sign in to comment.