tests: deprecated TestCase.assert_() -> assert keyword

https://github.com/eventlet/eventlet/issues/101
This commit is contained in:
Sergey Shepelev
2014-07-16 13:54:42 +04:00
parent d2ec34fb14
commit a651a3097f
21 changed files with 230 additions and 230 deletions

View File

@@ -185,18 +185,14 @@ class LimitedTestCase(unittest.TestCase):
verify_hub_empty()
def assert_less_than(self, a, b, msg=None):
if msg:
self.assert_(a < b, msg)
else:
self.assert_(a < b, "%s not less than %s" % (a, b))
msg = msg or "%s not less than %s" % (a, b)
assert a < b, msg
assertLessThan = assert_less_than
def assert_less_than_equal(self, a, b, msg=None):
if msg:
self.assert_(a <= b, msg)
else:
self.assert_(a <= b, "%s not less than or equal to %s" % (a, b))
msg = msg or "%s not less than or equal to %s" % (a, b)
assert a <= b, msg
assertLessThanEqual = assert_less_than_equal

View File

@@ -14,10 +14,10 @@ class BackdoorTest(LimitedTestCase):
client = socket.socket()
client.connect(('localhost', listener.getsockname()[1]))
f = client.makefile('rw')
self.assert_(b'Python' in f.readline())
assert b'Python' in f.readline()
f.readline() # build info
f.readline() # help info
self.assert_(b'InteractiveConsole' in f.readline())
assert b'InteractiveConsole' in f.readline()
self.assertEqual(b'>>> ', f.read(4))
f.write(b'print("hi")\n')
f.flush()

View File

@@ -74,10 +74,10 @@ class DBConnectionPool(DBTester):
def assert_cursor_works(self, cursor):
cursor.execute("select 1")
rows = cursor.fetchall()
self.assert_(rows)
assert rows
def test_connecting(self):
self.assert_(self.connection is not None)
assert self.connection is not None
def test_create_cursor(self):
cursor = self.connection.cursor()
@@ -92,7 +92,7 @@ class DBConnectionPool(DBTester):
cursor = self.connection.cursor()
try:
cursor.execute("garbage blah blah")
self.assert_(False)
assert False
except AssertionError:
raise
except Exception:
@@ -101,39 +101,39 @@ class DBConnectionPool(DBTester):
def test_put_none(self):
# the pool is of size 1, and its only connection is out
self.assert_(self.pool.free() == 0)
assert self.pool.free() == 0
self.pool.put(None)
# ha ha we fooled it into thinking that we had a dead process
self.assert_(self.pool.free() == 1)
assert self.pool.free() == 1
conn2 = self.pool.get()
self.assert_(conn2 is not None)
self.assert_(conn2.cursor)
assert conn2 is not None
assert conn2.cursor
self.pool.put(conn2)
def test_close_does_a_put(self):
self.assert_(self.pool.free() == 0)
assert self.pool.free() == 0
self.connection.close()
self.assert_(self.pool.free() == 1)
assert self.pool.free() == 1
self.assertRaises(AttributeError, self.connection.cursor)
@skipped
def test_deletion_does_a_put(self):
# doing a put on del causes some issues if __del__ is called in the
# main coroutine, so, not doing that for now
self.assert_(self.pool.free() == 0)
assert self.pool.free() == 0
self.connection = None
self.assert_(self.pool.free() == 1)
assert self.pool.free() == 1
def test_put_doesnt_double_wrap(self):
self.pool.put(self.connection)
conn = self.pool.get()
self.assert_(not isinstance(conn._base, db_pool.PooledConnectionWrapper))
assert not isinstance(conn._base, db_pool.PooledConnectionWrapper)
self.pool.put(conn)
def test_bool(self):
self.assert_(self.connection)
assert self.connection
self.connection.close()
self.assert_(not self.connection)
assert not self.connection
def fill_up_table(self, conn):
curs = conn.cursor()
@@ -268,7 +268,7 @@ class DBConnectionPool(DBTester):
self.assert_(isinstance(self.connection,
db_pool.GenericConnectionWrapper))
conn = self.pool._unwrap_connection(self.connection)
self.assert_(not isinstance(conn, db_pool.GenericConnectionWrapper))
assert not isinstance(conn, db_pool.GenericConnectionWrapper)
self.assertEqual(None, self.pool._unwrap_connection(None))
self.assertEqual(None, self.pool._unwrap_connection(1))

View File

@@ -22,12 +22,12 @@ class TestSpew(TestCase):
def test_spew(self):
debug.spew()
self.failUnless(isinstance(self.tracer, debug.Spew))
assert isinstance(self.tracer, debug.Spew)
def test_unspew(self):
debug.spew()
debug.unspew()
self.failUnlessEqual(self.tracer, None)
assert self.tracer is None
def test_line(self):
sys.stdout = six.StringIO()
@@ -36,8 +36,8 @@ class TestSpew(TestCase):
s(f, "line", None)
lineno = f.f_lineno - 1 # -1 here since we called with frame f in the line above
output = sys.stdout.getvalue()
self.failUnless("%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output))
self.failUnless("f=<frame object at" in output)
assert "%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output)
assert "f=<frame object at" in output
def test_line_nofile(self):
sys.stdout = six.StringIO()
@@ -48,8 +48,8 @@ class TestSpew(TestCase):
lineno = f.f_lineno
s(f, "line", None)
output = sys.stdout.getvalue()
self.failUnless("[unknown]:%i" % lineno in output, "Didn't find [unknown]:%i in %s" % (lineno, output))
self.failUnless("VM instruction #" in output, output)
assert "[unknown]:%i" % lineno in output, "Didn't find [unknown]:%i in %s" % (lineno, output)
assert "VM instruction #" in output, output
def test_line_global(self):
global GLOBAL_VAR
@@ -59,10 +59,10 @@ class TestSpew(TestCase):
GLOBAL_VAR(f, "line", None)
lineno = f.f_lineno - 1 # -1 here since we called with frame f in the line above
output = sys.stdout.getvalue()
self.failUnless("%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output))
self.failUnless("f=<frame object at" in output)
self.failUnless("GLOBAL_VAR" in f.f_globals)
self.failUnless("GLOBAL_VAR=<eventlet.debug.Spew object at" in output)
assert "%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output)
assert "f=<frame object at" in output
assert "GLOBAL_VAR" in f.f_globals
assert "GLOBAL_VAR=<eventlet.debug.Spew object at" in output
del GLOBAL_VAR
def test_line_novalue(self):
@@ -72,8 +72,8 @@ class TestSpew(TestCase):
s(f, "line", None)
lineno = f.f_lineno - 1 # -1 here since we called with frame f in the line above
output = sys.stdout.getvalue()
self.failUnless("%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output))
self.failIf("f=<frame object at" in output)
assert "%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output)
assert "f=<frame object at" not in output
def test_line_nooutput(self):
sys.stdout = six.StringIO()
@@ -81,7 +81,7 @@ class TestSpew(TestCase):
f = sys._getframe()
s(f, "line", None)
output = sys.stdout.getvalue()
self.failUnlessEqual(output, "")
assert output == ""
class TestDebug(LimitedTestCase):
@@ -123,8 +123,7 @@ class TestDebug(LimitedTestCase):
self.assertRaises(KeyError, gt.wait)
debug.hub_exceptions(False)
# look for the KeyError exception in the traceback
self.assert_('KeyError: 1' in fake.getvalue(),
"Traceback not in:\n" + fake.getvalue())
assert 'KeyError: 1' in fake.getvalue(), "Traceback not in:\n" + fake.getvalue()
if __name__ == "__main__":
main()

View File

@@ -84,7 +84,7 @@ tpool.execute(do)
output, lines = self.launch_subprocess('newmod.py')
self.assertEqual(len(lines), 4, lines)
self.assertEqual(lines[-2], 'ran it', lines)
self.assert_('Warning' in lines[1] or 'Warning' in lines[0], lines)
assert 'Warning' in lines[1] or 'Warning' in lines[0], lines
finally:
del os.environ['EVENTLET_THREADPOOL_SIZE']
@@ -110,5 +110,4 @@ print(hubs.get_hub())
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
self.assertEqual(len(lines), 2, "\n".join(lines))
self.assert_("selects" in lines[0])
assert "selects" in lines[0]

View File

@@ -76,7 +76,7 @@ class TestGreenSocket(LimitedTestCase):
gs.connect(('192.0.2.1', 80))
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
except socket.error as e:
# unreachable is also a valid outcome
@@ -94,7 +94,7 @@ class TestGreenSocket(LimitedTestCase):
gs.accept()
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
def test_connect_ex_timeout(self):
@@ -130,7 +130,7 @@ class TestGreenSocket(LimitedTestCase):
client.recv(8192)
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
evt.send()
@@ -146,7 +146,7 @@ class TestGreenSocket(LimitedTestCase):
gs.recvfrom(8192)
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
def test_recvfrom_into_timeout(self):
@@ -161,7 +161,7 @@ class TestGreenSocket(LimitedTestCase):
gs.recvfrom_into(buf)
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
def test_recv_into_timeout(self):
@@ -191,7 +191,7 @@ class TestGreenSocket(LimitedTestCase):
client.recv_into(buf)
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
evt.send()
@@ -226,7 +226,7 @@ class TestGreenSocket(LimitedTestCase):
total_sent += client.send(msg)
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
evt.send()
@@ -259,7 +259,7 @@ class TestGreenSocket(LimitedTestCase):
client.sendall(msg)
self.fail("socket.timeout not raised")
except socket.timeout as e:
self.assert_(hasattr(e, 'args'))
assert hasattr(e, 'args')
self.assertEqual(e.args[0], 'timed out')
evt.send()
@@ -524,7 +524,7 @@ class TestGreenSocket(LimitedTestCase):
try:
while True:
data = client.recv(1024)
self.assert_(data)
assert data
except socket.error as e:
# we get an EBADF because client is closed in the same process
# (but a different greenthread)
@@ -776,8 +776,8 @@ class TestGreenIoLong(LimitedTestCase):
client.close()
server_coro.wait()
listener.close()
self.assert_(len(results1) > 0)
self.assert_(len(results2) > 0)
assert len(results1) > 0
assert len(results2) > 0
debug.hub_prevent_multiple_readers()
@skipped # by rdw because it fails but it's not clear how to make it pass

View File

@@ -420,7 +420,7 @@ class Stress(tests.LimitedTestCase):
if received % 5 == 0:
eventlet.sleep(0.0001)
unique, order = i
self.assert_(latest[unique] < order)
assert latest[unique] < order
latest[unique] = order
for l in latest[1:]:
self.assertEqual(l, iters - 1)
@@ -449,14 +449,14 @@ class Stress(tests.LimitedTestCase):
if latest == -1:
gc.collect()
initial_obj_count = len(gc.get_objects())
self.assert_(i > latest)
assert i > latest
latest = i
if latest % 5 == 0:
eventlet.sleep(0.001)
if latest % 10 == 0:
gc.collect()
objs_created = len(gc.get_objects()) - initial_obj_count
self.assert_(objs_created < 25 * concurrency, objs_created)
assert objs_created < 25 * concurrency, objs_created
# make sure we got to the end
self.assertEqual(latest, count - 1)

View File

@@ -16,8 +16,8 @@ class Asserts(object):
def assert_dead(self, gt):
if hasattr(gt, 'wait'):
self.assertRaises(greenlet.GreenletExit, gt.wait)
self.assert_(gt.dead)
self.assert_(not gt)
assert gt.dead
assert not gt
class Spawn(LimitedTestCase, Asserts):
def tearDown(self):
@@ -32,9 +32,9 @@ class Spawn(LimitedTestCase, Asserts):
def test_n(self):
gt = greenthread.spawn_n(passthru, 2, b=3)
self.assert_(not gt.dead)
assert not gt.dead
greenthread.sleep(0)
self.assert_(gt.dead)
assert gt.dead
self.assertEqual(_g_results, [((2,),{'b':3})])
def test_kill(self):

View File

@@ -215,7 +215,7 @@ class TestHubSelection(LimitedTestCase):
oldhub = hubs.get_hub()
try:
hubs.use_hub(Foo)
self.assert_(isinstance(hubs.get_hub(), Foo), hubs.get_hub())
assert isinstance(hubs.get_hub(), Foo), hubs.get_hub()
finally:
hubs._threadlocal.hub = oldhub
@@ -282,7 +282,7 @@ except eventlet.Timeout:
os.kill(p.pid, signal.SIGCONT)
output, _ = p.communicate()
lines = output.decode('utf-8', 'replace').splitlines()
self.assert_("exited correctly" in lines[-1], output)
assert "exited correctly" in lines[-1], output
shutil.rmtree(self.tempdir)

View File

@@ -125,7 +125,7 @@ class TestMySQLdb(LimitedTestCase):
self.assertEqual(len(rows), 1)
self.assertEqual(len(rows[0]), 1)
self.assertEqual(rows[0][0], 1)
self.assert_(counter[0] > 0, counter[0])
assert counter[0] > 0, counter[0]
gt.kill()
def assert_cursor_works(self, cursor):
@@ -145,10 +145,10 @@ class TestMySQLdb(LimitedTestCase):
for key in dir(orig):
if key not in ('__author__', '__path__', '__revision__',
'__version__', '__loader__'):
self.assert_(hasattr(MySQLdb, key), "%s %s" % (key, getattr(orig, key)))
assert hasattr(MySQLdb, key), "%s %s" % (key, getattr(orig, key))
def test_connecting(self):
self.assert_(self.connection is not None)
assert self.connection is not None
def test_connecting_annoyingly(self):
self.assert_connection_works(MySQLdb.Connect(**self._auth))
@@ -168,7 +168,7 @@ class TestMySQLdb(LimitedTestCase):
cursor = self.connection.cursor()
try:
cursor.execute("garbage blah blah")
self.assert_(False)
assert False
except AssertionError:
raise
except Exception:

View File

@@ -53,4 +53,4 @@ class PatchingPsycopg(patcher_test.ProcessBase):
print("Can't test psycopg2 patching; it's not installed.")
return
# if there's anything wrong with the test program it'll have a stack trace
self.assert_(lines[0].startswith('done'), output)
assert lines[0].startswith('done'), output

View File

@@ -68,14 +68,14 @@ class ImportPatched(ProcessBase):
self.write_to_tempfile("patching", patching_module_contents)
self.write_to_tempfile("importing", import_module_contents)
output, lines = self.launch_subprocess('importing.py')
self.assert_(lines[0].startswith('patcher'), repr(output))
self.assert_(lines[1].startswith('base'), repr(output))
self.assert_(lines[2].startswith('importing'), repr(output))
self.assert_('eventlet.green.socket' in lines[1], repr(output))
self.assert_('eventlet.green.urllib' in lines[1], repr(output))
self.assert_('eventlet.green.socket' in lines[2], repr(output))
self.assert_('eventlet.green.urllib' in lines[2], repr(output))
self.assert_('eventlet.green.httplib' not in lines[2], repr(output))
assert lines[0].startswith('patcher'), repr(output)
assert lines[1].startswith('base'), repr(output)
assert lines[2].startswith('importing'), repr(output)
assert 'eventlet.green.socket' in lines[1], repr(output)
assert 'eventlet.green.urllib' in lines[1], repr(output)
assert 'eventlet.green.socket' in lines[2], repr(output)
assert 'eventlet.green.urllib' in lines[2], repr(output)
assert 'eventlet.green.httplib' not in lines[2], repr(output)
def test_import_patched_defaults(self):
self.write_to_tempfile("base", base_module_contents)
@@ -86,10 +86,10 @@ print("newmod {0} {1} {2}".format(base, base.socket, base.urllib.socket.socket))
"""
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
self.assert_(lines[0].startswith('base'), repr(output))
self.assert_(lines[1].startswith('newmod'), repr(output))
self.assert_('eventlet.green.socket' in lines[1], repr(output))
self.assert_('GreenSocket' in lines[1], repr(output))
assert lines[0].startswith('base'), repr(output)
assert lines[1].startswith('newmod'), repr(output)
assert 'eventlet.green.socket' in lines[1], repr(output)
assert 'GreenSocket' in lines[1], repr(output)
class MonkeyPatch(ProcessBase):
@@ -103,7 +103,7 @@ print("newmod {0} {1}".format(socket.socket, urllib.socket.socket))
"""
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
self.assert_(lines[0].startswith('newmod'), repr(output))
assert lines[0].startswith('newmod'), repr(output)
self.assertEqual(lines[0].count('GreenSocket'), 2, repr(output))
def test_early_patching(self):
@@ -117,7 +117,7 @@ print("newmod")
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
self.assertEqual(len(lines), 2, repr(output))
self.assert_(lines[0].startswith('newmod'), repr(output))
assert lines[0].startswith('newmod'), repr(output)
def test_late_patching(self):
new_mod = """
@@ -131,7 +131,7 @@ print("newmod")
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
self.assertEqual(len(lines), 2, repr(output))
self.assert_(lines[0].startswith('newmod'), repr(output))
assert lines[0].startswith('newmod'), repr(output)
def test_typeerror(self):
new_mod = """
@@ -140,8 +140,8 @@ patcher.monkey_patch(finagle=True)
"""
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
self.assert_(lines[-2].startswith('TypeError'), repr(output))
self.assert_('finagle' in lines[-2], repr(output))
assert lines[-2].startswith('TypeError'), repr(output)
assert 'finagle' in lines[-2], repr(output)
def assert_boolean_logic(self, call, expected, not_expected=''):
expected_list = ", ".join(['"%s"' % x for x in expected.split(',') if len(x)])
@@ -158,7 +158,7 @@ print("already_patched {0}".format(",".join(sorted(patcher.already_patched.keys(
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
ap = 'already_patched'
self.assert_(lines[0].startswith(ap), repr(output))
assert lines[0].startswith(ap), repr(output)
patched_modules = lines[0][len(ap):].strip()
# psycopg might or might not be patched based on installed modules
patched_modules = patched_modules.replace("psycopg,", "")
@@ -245,9 +245,9 @@ tpool.killall()
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod.py')
self.assertEqual(len(lines), 3, output)
self.assert_(lines[0].startswith('newmod'), repr(output))
self.assert_('2' in lines[0], repr(output))
self.assert_('3' in lines[1], repr(output))
assert lines[0].startswith('newmod'), repr(output)
assert '2' in lines[0], repr(output)
assert '3' in lines[1], repr(output)
@skip_with_pyevent
def test_unpatched_thread(self):
@@ -308,7 +308,7 @@ print(len(_threading._active))
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod')
self.assertEqual(len(lines), 4, "\n".join(lines))
self.assert_(lines[0].startswith('<Thread'), lines[0])
assert lines[0].startswith('<Thread'), lines[0]
self.assertEqual(lines[1], "1", lines[1])
self.assertEqual(lines[2], "1", lines[2])
@@ -326,7 +326,7 @@ print(len(threading._active))
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod')
self.assertEqual(len(lines), 3, "\n".join(lines))
self.assert_(lines[0].startswith('<_MainThread'), lines[0])
assert lines[0].startswith('<_MainThread'), lines[0]
self.assertEqual(lines[1], "1", lines[1])
def test_tpool(self):
@@ -342,7 +342,7 @@ print(len(threading._active))
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod')
self.assertEqual(len(lines), 3, "\n".join(lines))
self.assert_(lines[0].startswith('<Thread'), lines[0])
assert lines[0].startswith('<Thread'), lines[0]
self.assertEqual(lines[1], "1", lines[1])
def test_greenlet(self):
@@ -361,7 +361,7 @@ print(len(threading._active))
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod')
self.assertEqual(len(lines), 3, "\n".join(lines))
self.assert_(lines[0].startswith('<_MainThread'), lines[0])
assert lines[0].startswith('<_MainThread'), lines[0]
self.assertEqual(lines[1], "1", lines[1])
def test_greenthread(self):
@@ -377,7 +377,7 @@ print(len(threading._active))
self.write_to_tempfile("newmod", new_mod)
output, lines = self.launch_subprocess('newmod')
self.assertEqual(len(lines), 3, "\n".join(lines))
self.assert_(lines[0].startswith('<_GreenThread'), lines[0])
assert lines[0].startswith('<_GreenThread'), lines[0]
self.assertEqual(lines[1], "1", lines[1])
def test_keyerror(self):
@@ -426,7 +426,7 @@ t2.join()
""")
output, lines = self.launch_subprocess('newmod')
self.assertEqual(len(lines), 2, "\n".join(lines))
self.assert_(lines[0].startswith('<_GreenThread'), lines[0])
assert lines[0].startswith('<_GreenThread'), lines[0]
def test_name(self):
self.write_to_tempfile("newmod", self.prologue + """

View File

@@ -102,7 +102,7 @@ class TestDyingProcessesLeavePool(LimitedTestCase):
finally:
self.pool.put(proc)
proc2 = self.pool.get()
self.assert_(proc is not proc2)
assert proc is not proc2
if __name__ == '__main__':

View File

@@ -62,7 +62,7 @@ class TestQueue(LimitedTestCase):
evt = event.Event()
gt = eventlet.spawn(sender, evt, q)
eventlet.sleep(0)
self.assert_(not evt.ready())
assert not evt.ready()
gt2 = eventlet.spawn(receiver, q)
self.assertEqual(gt2.wait(),'hi')
self.assertEqual(evt.wait(),'done')
@@ -77,10 +77,10 @@ class TestQueue(LimitedTestCase):
evt = event.Event()
gt = eventlet.spawn(sender, evt, q)
eventlet.sleep(0)
self.assert_(not evt.ready())
assert not evt.ready()
q.resize(1)
eventlet.sleep(0)
self.assert_(evt.ready())
assert evt.ready()
gt.wait()
def test_resize_down(self):

View File

@@ -70,7 +70,7 @@ class TestQueue(LimitedTestCase):
spawn(sender, e1, q)
sleep(0)
self.assert_(not e1.ready())
assert not e1.ready()
spawn(receiver, e2, q)
self.assertEqual(e2.wait(),'hi')
self.assertEqual(e1.wait(),'done')

View File

@@ -1,11 +1,11 @@
import gc
import weakref
from eventlet.green import thread
from eventlet import greenthread
from eventlet import event
import eventlet
from eventlet import corolocal
from eventlet import event
from eventlet import greenthread
from eventlet.green import thread
from eventlet.support import six
from tests import LimitedTestCase, skipped
@@ -29,25 +29,28 @@ class Locals(LimitedTestCase):
tls = thread._local()
g_ids = []
evt = event.Event()
def setter(tls, v):
g_id = id(greenthread.getcurrent())
g_ids.append(g_id)
tls.value = v
evt.wait()
thread.start_new_thread(setter, args=(tls, 1))
thread.start_new_thread(setter, args=(tls, 2))
eventlet.sleep()
objs = object.__getattribute__(tls, "__objs")
self.failUnlessEqual(sorted(g_ids), sorted(objs.keys()))
self.failUnlessEqual(objs[g_ids[0]]['value'], 1)
self.failUnlessEqual(objs[g_ids[1]]['value'], 2)
self.failUnlessRaises(AttributeError, lambda: tls.value)
assert sorted(g_ids) == sorted(objs.keys())
assert objs[g_ids[0]]['value'] == 1
assert objs[g_ids[1]]['value'] == 2
assert getattr(tls, 'value', None) is None
evt.send("done")
eventlet.sleep()
def test_assignment(self):
my_local = corolocal.local()
my_local.a = 1
def do_something():
my_local.b = 2
self.assertEqual(my_local.b, 2)
@@ -56,11 +59,13 @@ class Locals(LimitedTestCase):
self.fail()
except AttributeError:
pass
eventlet.spawn(do_something).wait()
self.assertEqual(my_local.a, 1)
def test_calls_init(self):
init_args = []
class Init(corolocal.local):
def __init__(self, *args):
init_args.append((args, eventlet.getcurrent()))
@@ -98,8 +103,10 @@ class Locals(LimitedTestCase):
def test_no_leaking(self):
refs = weakref.WeakKeyDictionary()
my_local = corolocal.local()
class X(object):
pass
def do_something(i):
o = X()
refs[o] = True

View File

@@ -37,10 +37,10 @@ class TestWithTimeout(LimitedTestCase):
self.assertRaises(timeout.Timeout, timeout.with_timeout, DELAY, greenthread.sleep, DELAY*10)
X = object()
r = timeout.with_timeout(DELAY, greenthread.sleep, DELAY*10, timeout_value=X)
self.assert_(r is X, (r, X))
assert r is X, (r, X)
r = timeout.with_timeout(DELAY*10, greenthread.sleep,
DELAY, timeout_value=X)
self.assert_(r is None, r)
assert r is None, r
def test_with_outer_timer(self):
@@ -51,4 +51,3 @@ class TestWithTimeout(LimitedTestCase):
timeout_value='b')
self.assertRaises(timeout.Timeout,
timeout.with_timeout, DELAY, longer_timeout)

View File

@@ -91,7 +91,7 @@ class TestTpool(LimitedTestCase):
self.assertEqual(tpool.Proxy, type(prox))
exp = prox.compile('(.)(.)(.)')
self.assertEqual(exp.groups, 3)
self.assert_(repr(prox.compile))
assert repr(prox.compile)
@skip_with_pyevent
def test_wrap_eq(self):
@@ -100,20 +100,20 @@ class TestTpool(LimitedTestCase):
exp2 = prox.compile(exp1.pattern)
self.assertEqual(exp1, exp2)
exp3 = prox.compile('/')
self.assert_(exp1 != exp3)
assert exp1 != exp3
@skip_with_pyevent
def test_wrap_ints(self):
p = tpool.Proxy(4)
self.assert_(p == 4)
assert p == 4
@skip_with_pyevent
def test_wrap_hash(self):
prox1 = tpool.Proxy(''+'A')
prox2 = tpool.Proxy('A'+'')
self.assert_(prox1 == 'A')
self.assert_('A' == prox2)
#self.assert_(prox1 == prox2) FIXME - could __eq__ unwrap rhs if it is other proxy?
assert prox1 == 'A'
assert 'A' == prox2
#assert prox1 == prox2 FIXME - could __eq__ unwrap rhs if it is other proxy?
self.assertEqual(hash(prox1), hash(prox2))
proxList = tpool.Proxy([])
self.assertRaises(TypeError, hash, proxList)
@@ -122,9 +122,9 @@ class TestTpool(LimitedTestCase):
def test_wrap_nonzero(self):
prox = tpool.Proxy(re)
exp1 = prox.compile('.')
self.assert_(bool(exp1))
assert bool(exp1)
prox2 = tpool.Proxy([1, 2, 3])
self.assert_(bool(prox2))
assert bool(prox2)
@skip_with_pyevent
def test_multiple_wraps(self):
@@ -178,10 +178,10 @@ class TestTpool(LimitedTestCase):
gt = eventlet.spawn(tick)
previtem = 0
for item in tpool.Proxy(foo()):
self.assert_(item >= previtem)
assert item >= previtem
# make sure the tick happened at least a few times so that we know
# that our iterations in foo() were actually tpooled
self.assert_(counter[0] > 10, counter[0])
assert counter[0] > 10, counter[0]
gt.kill()
@skip_with_pyevent
@@ -231,31 +231,31 @@ class TestTpool(LimitedTestCase):
@skip_with_pyevent
def test_autowrap(self):
x = tpool.Proxy({'a': 1, 'b': 2}, autowrap=(int,))
self.assert_(isinstance(x.get('a'), tpool.Proxy))
self.assert_(not isinstance(x.items(), tpool.Proxy))
assert isinstance(x.get('a'), tpool.Proxy)
assert not isinstance(x.items(), tpool.Proxy)
# attributes as well as callables
from tests import tpool_test
x = tpool.Proxy(tpool_test, autowrap=(int,))
self.assert_(isinstance(x.one, tpool.Proxy))
self.assert_(not isinstance(x.none, tpool.Proxy))
assert isinstance(x.one, tpool.Proxy)
assert not isinstance(x.none, tpool.Proxy)
@skip_with_pyevent
def test_autowrap_names(self):
x = tpool.Proxy({'a': 1, 'b': 2}, autowrap_names=('get',))
self.assert_(isinstance(x.get('a'), tpool.Proxy))
self.assert_(not isinstance(x.items(), tpool.Proxy))
assert isinstance(x.get('a'), tpool.Proxy)
assert not isinstance(x.items(), tpool.Proxy)
from tests import tpool_test
x = tpool.Proxy(tpool_test, autowrap_names=('one',))
self.assert_(isinstance(x.one, tpool.Proxy))
self.assert_(not isinstance(x.two, tpool.Proxy))
assert isinstance(x.one, tpool.Proxy)
assert not isinstance(x.two, tpool.Proxy)
@skip_with_pyevent
def test_autowrap_both(self):
from tests import tpool_test
x = tpool.Proxy(tpool_test, autowrap=(int,), autowrap_names=('one',))
self.assert_(isinstance(x.one, tpool.Proxy))
assert isinstance(x.one, tpool.Proxy)
# violating the abstraction to check that we didn't double-wrap
self.assert_(not isinstance(x._obj, tpool.Proxy))
assert not isinstance(x._obj, tpool.Proxy)
@skip_with_pyevent
def test_callable(self):
@@ -265,7 +265,7 @@ class TestTpool(LimitedTestCase):
self.assertEqual(4, x(4))
# verify that it wraps return values if specified
x = tpool.Proxy(wrapped, autowrap_names=('__call__',))
self.assert_(isinstance(x(4), tpool.Proxy))
assert isinstance(x(4), tpool.Proxy)
self.assertEqual("4", str(x(4)))
@skip_with_pyevent

View File

@@ -159,7 +159,7 @@ class TestWebSocket(_TestBase):
resp = sock.recv(1024) # get the headers
sock.close() # close while the app is running
done_with_request.wait()
self.assert_(not error_detected[0])
assert not error_detected[0]
def test_client_closing_connection_13(self):
error_detected = [False]
@@ -191,7 +191,7 @@ class TestWebSocket(_TestBase):
closeframe = struct.pack('!BBIH', 1 << 7 | 8, 1 << 7 | 2, 0, 1000)
sock.sendall(closeframe) # "Close the connection" packet.
done_with_request.wait()
self.assert_(not error_detected[0])
assert not error_detected[0]
def test_client_invalid_packet_13(self):
error_detected = [False]
@@ -222,4 +222,4 @@ class TestWebSocket(_TestBase):
resp = sock.recv(1024) # get the headers
sock.sendall('\x07\xff') # Weird packet.
done_with_request.wait()
self.assert_(not error_detected[0])
assert not error_detected[0]

View File

@@ -330,7 +330,7 @@ class TestWebSocket(_TestBase):
resp = sock.recv(1024) # get the headers
sock.close() # close while the app is running
done_with_request.wait()
self.assert_(not error_detected[0])
assert not error_detected[0]
def test_breaking_the_connection_76(self):
error_detected = [False]
@@ -363,7 +363,7 @@ class TestWebSocket(_TestBase):
resp = sock.recv(1024) # get the headers
sock.close() # close while the app is running
done_with_request.wait()
self.assert_(not error_detected[0])
assert not error_detected[0]
def test_client_closing_connection_76(self):
error_detected = [False]
@@ -396,7 +396,7 @@ class TestWebSocket(_TestBase):
resp = sock.recv(1024) # get the headers
sock.sendall('\xff\x00') # "Close the connection" packet.
done_with_request.wait()
self.assert_(not error_detected[0])
assert not error_detected[0]
def test_client_invalid_packet_76(self):
error_detected = [False]
@@ -429,7 +429,7 @@ class TestWebSocket(_TestBase):
resp = sock.recv(1024) # get the headers
sock.sendall('\xef\x00') # Weird packet.
done_with_request.wait()
self.assert_(error_detected[0])
assert error_detected[0]
def test_server_closing_connect_76(self):
connect = [
@@ -479,7 +479,7 @@ class TestWebSocket(_TestBase):
sock.sendall('\r\n'.join(connect) + '\r\n\r\n')
resp = sock.recv(1024)
done_with_request.wait()
self.assert_(error_detected[0])
assert error_detected[0]
def test_app_socket_errors_76(self):
error_detected = [False]
@@ -511,7 +511,7 @@ class TestWebSocket(_TestBase):
sock.sendall('\r\n'.join(connect) + '\r\n\r\n^n:ds[4U')
resp = sock.recv(1024)
done_with_request.wait()
self.assert_(error_detected[0])
assert error_detected[0]
class TestWebSocketSSL(_TestBase):
@@ -584,11 +584,11 @@ class TestWebSocketObject(LimitedTestCase):
def test_send_to_ws(self):
ws = self.test_ws
ws.send(u'hello')
self.assert_(ws.socket.sendall.called_with("\x00hello\xFF"))
assert ws.socket.sendall.called_with("\x00hello\xFF")
ws.send(10)
self.assert_(ws.socket.sendall.called_with("\x0010\xFF"))
assert ws.socket.sendall.called_with("\x0010\xFF")
def test_close_ws(self):
ws = self.test_ws
ws.close()
self.assert_(ws.socket.shutdown.called_with(True))
assert ws.socket.shutdown.called_with(True)

View File

@@ -263,8 +263,8 @@ class TestHttpd(_TestBase):
result = fd.read()
fd.close()
## The server responds with the maximum version it supports
self.assert_(result.startswith('HTTP'), result)
self.assert_(result.endswith('hello world'))
assert result.startswith('HTTP'), result
assert result.endswith('hello world')
def test_002_keepalive(self):
sock = eventlet.connect(
@@ -388,7 +388,7 @@ class TestHttpd(_TestBase):
fd = sock.makefile('rw')
fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n')
fd.flush()
self.assert_('Transfer-Encoding: chunked' in fd.read())
assert 'Transfer-Encoding: chunked' in fd.read()
def test_010_no_chunked_http_1_0(self):
self.site.application = chunked_app
@@ -398,7 +398,7 @@ class TestHttpd(_TestBase):
fd = sock.makefile('rw')
fd.write('GET / HTTP/1.0\r\nHost: localhost\r\nConnection: close\r\n\r\n')
fd.flush()
self.assert_('Transfer-Encoding: chunked' not in fd.read())
assert 'Transfer-Encoding: chunked' not in fd.read()
def test_011_multiple_chunks(self):
self.site.application = big_chunks
@@ -415,7 +415,7 @@ class TestHttpd(_TestBase):
break
else:
headers += line
self.assert_('Transfer-Encoding: chunked' in headers)
assert 'Transfer-Encoding: chunked' in headers
chunks = 0
chunklen = int(fd.readline(), 16)
while chunklen:
@@ -423,7 +423,7 @@ class TestHttpd(_TestBase):
fd.read(chunklen)
fd.readline() # CRLF
chunklen = int(fd.readline(), 16)
self.assert_(chunks > 1)
assert chunks > 1
response = fd.read()
# Require a CRLF to close the message body
self.assertEqual(response, '\r\n')
@@ -481,7 +481,7 @@ class TestHttpd(_TestBase):
if fd.readline() == '\r\n':
break
response = fd.read()
self.assert_(response == 'oh hai', 'invalid response %s' % response)
assert response == 'oh hai', 'invalid response %s' % response
sock = eventlet.connect(('localhost', self.port))
fd = sock.makefile('rw')
@@ -493,7 +493,7 @@ class TestHttpd(_TestBase):
if fd.readline() == '\r\n':
break
response = fd.read()
self.assert_(response == 'oh hai', 'invalid response %s' % response)
assert response == 'oh hai', 'invalid response %s' % response
sock = eventlet.connect(('localhost', self.port))
fd = sock.makefile('rw')
@@ -505,7 +505,7 @@ class TestHttpd(_TestBase):
if fd.readline() == '\r\n':
break
response = fd.read(8192)
self.assert_(response == 'oh hai', 'invalid response %s' % response)
assert response == 'oh hai', 'invalid response %s' % response
def test_015_write(self):
self.site.application = use_write
@@ -514,15 +514,15 @@ class TestHttpd(_TestBase):
fd.write('GET /a HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n')
fd.flush()
result1 = read_http(sock)
self.assert_('content-length' in result1.headers_lower)
assert 'content-length' in result1.headers_lower
sock = eventlet.connect(('localhost', self.port))
fd = sock.makefile('w')
fd.write('GET /b HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n')
fd.flush()
result2 = read_http(sock)
self.assert_('transfer-encoding' in result2.headers_lower)
self.assert_(result2.headers_lower['transfer-encoding'] == 'chunked')
assert 'transfer-encoding' in result2.headers_lower
assert result2.headers_lower['transfer-encoding'] == 'chunked'
def test_016_repeated_content_length(self):
"""
@@ -580,7 +580,7 @@ class TestHttpd(_TestBase):
client.close()
success = server_coro.wait()
self.assert_(success)
assert success
def test_018_http_10_keepalive(self):
# verify that if an http/1.0 client sends connection: keep-alive
@@ -593,13 +593,13 @@ class TestHttpd(_TestBase):
fd.flush()
result1 = read_http(sock)
self.assert_('connection' in result1.headers_lower)
assert 'connection' in result1.headers_lower
self.assertEqual('keep-alive', result1.headers_lower['connection'])
# repeat request to verify connection is actually still open
fd.write('GET / HTTP/1.0\r\nHost: localhost\r\nConnection: keep-alive\r\n\r\n')
fd.flush()
result2 = read_http(sock)
self.assert_('connection' in result2.headers_lower)
assert 'connection' in result2.headers_lower
self.assertEqual('keep-alive', result2.headers_lower['connection'])
sock.close()
@@ -621,7 +621,7 @@ class TestHttpd(_TestBase):
'2\r\noh\r\n'
'4\r\n hai\r\n0\r\n\r\n')
fd.flush()
self.assert_('hello!' in fd.read())
assert 'hello!' in fd.read()
def test_020_x_forwarded_for(self):
request_bytes = (
@@ -633,7 +633,7 @@ class TestHttpd(_TestBase):
sock.sendall(request_bytes)
sock.recv(1024)
sock.close()
self.assert_('1.2.3.4,5.6.7.8,127.0.0.1' in self.logfile.getvalue())
assert '1.2.3.4,5.6.7.8,127.0.0.1' in self.logfile.getvalue()
# turning off the option should work too
self.logfile = six.StringIO()
@@ -643,9 +643,9 @@ class TestHttpd(_TestBase):
sock.sendall(request_bytes)
sock.recv(1024)
sock.close()
self.assert_('1.2.3.4' not in self.logfile.getvalue())
self.assert_('5.6.7.8' not in self.logfile.getvalue())
self.assert_('127.0.0.1' in self.logfile.getvalue())
assert '1.2.3.4' not in self.logfile.getvalue()
assert '5.6.7.8' not in self.logfile.getvalue()
assert '127.0.0.1' in self.logfile.getvalue()
def test_socket_remains_open(self):
greenthread.kill(self.killer)
@@ -659,8 +659,8 @@ class TestHttpd(_TestBase):
fd.flush()
result = fd.read(1024)
fd.close()
self.assert_(result.startswith('HTTP'), result)
self.assert_(result.endswith('hello world'))
assert result.startswith('HTTP'), result
assert result.endswith('hello world')
# shut down the server and verify the server_socket fd is still open,
# but the actual socketobject passed in to wsgi.server is closed
@@ -678,8 +678,8 @@ class TestHttpd(_TestBase):
fd.flush()
result = fd.read(1024)
fd.close()
self.assert_(result.startswith('HTTP'), result)
self.assert_(result.endswith('hello world'))
assert result.startswith('HTTP'), result
assert result.endswith('hello world')
def test_021_environ_clobbering(self):
def clobberin_time(environ, start_response):
@@ -701,7 +701,7 @@ class TestHttpd(_TestBase):
'Connection: close\r\n'
'\r\n\r\n')
fd.flush()
self.assert_('200 OK' in fd.read())
assert '200 OK' in fd.read()
def test_022_custom_pool(self):
# just test that it accepts the parameter for now
@@ -718,8 +718,8 @@ class TestHttpd(_TestBase):
fd.flush()
result = fd.read()
fd.close()
self.assert_(result.startswith('HTTP'), result)
self.assert_(result.endswith('hello world'))
assert result.startswith('HTTP'), result
assert result.endswith('hello world')
def test_023_bad_content_length(self):
sock = eventlet.connect(
@@ -729,9 +729,9 @@ class TestHttpd(_TestBase):
fd.flush()
result = fd.read()
fd.close()
self.assert_(result.startswith('HTTP'), result)
self.assert_('400 Bad Request' in result)
self.assert_('500' not in result)
assert result.startswith('HTTP'), result
assert '400 Bad Request' in result
assert '500' not in result
def test_024_expect_100_continue(self):
def wsgi_app(environ, start_response):
@@ -759,7 +759,7 @@ class TestHttpd(_TestBase):
break
else:
header_lines.append(line)
self.assert_(header_lines[0].startswith('HTTP/1.1 100 Continue'))
assert header_lines[0].startswith('HTTP/1.1 100 Continue')
header_lines = []
while True:
line = fd.readline()
@@ -767,7 +767,7 @@ class TestHttpd(_TestBase):
break
else:
header_lines.append(line)
self.assert_(header_lines[0].startswith('HTTP/1.1 200 OK'))
assert header_lines[0].startswith('HTTP/1.1 200 OK')
self.assertEqual(fd.read(7), 'testing')
fd.close()
sock.close()
@@ -789,8 +789,8 @@ class TestHttpd(_TestBase):
except socket.error as exc:
self.assertEqual(get_errno(exc), errno.ECONNREFUSED)
self.assert_('Invalid argument' in self.logfile.getvalue(),
self.logfile.getvalue())
log_content = self.logfile.getvalue()
assert 'Invalid argument' in log_content, log_content
finally:
sys.stderr = old_stderr
debug.hub_exceptions(False)
@@ -801,7 +801,7 @@ class TestHttpd(_TestBase):
sock.sendall('GET /yo! HTTP/1.1\r\nHost: localhost\r\n\r\n')
sock.recv(1024)
sock.close()
self.assert_('\nHI GET /yo! HTTP/1.1 HI\n' in self.logfile.getvalue(), self.logfile.getvalue())
assert '\nHI GET /yo! HTTP/1.1 HI\n' in self.logfile.getvalue(), self.logfile.getvalue()
def test_close_chunked_with_1_0_client(self):
# verify that if we return a generator from our app
@@ -905,14 +905,14 @@ class TestHttpd(_TestBase):
else: # close sock prematurely
client.close()
eventlet.sleep(0) # let context switch back to server
self.assert_(not errored[0], errored[0])
assert not errored[0], errored[0]
# make another request to ensure the server's still alive
try:
client = ssl.wrap_socket(eventlet.connect(('localhost', port)))
client.write('GET / HTTP/1.0\r\nHost: localhost\r\n\r\n')
result = client.read()
self.assert_(result.startswith('HTTP'), result)
self.assert_(result.endswith('hello world'))
assert result.startswith('HTTP'), result
assert result.endswith('hello world')
except ImportError:
pass # TODO: should test with OpenSSL
greenthread.kill(g)
@@ -1042,7 +1042,7 @@ class TestHttpd(_TestBase):
headers.append(h)
if h == '':
break
self.assert_('Transfer-Encoding: chunked' in ''.join(headers))
assert 'Transfer-Encoding: chunked' in ''.join(headers)
# should only be one chunk of zero size with two blank lines
# (one terminates the chunk, one terminates the body)
self.assertEqual(response, ['0', '', ''])
@@ -1091,7 +1091,7 @@ class TestHttpd(_TestBase):
# the test passes if we successfully get here, and read all the data
# in spite of the early close
self.assertEqual(read_content.wait(), 'ok')
self.assert_(blew_up[0])
assert blew_up[0]
def test_exceptions_close_connection(self):
def wsgi_app(environ, start_response):
@@ -1104,7 +1104,7 @@ class TestHttpd(_TestBase):
result = read_http(sock)
self.assertEqual(result.status, 'HTTP/1.1 500 Internal Server Error')
self.assertEqual(result.headers_lower['connection'], 'close')
self.assert_('transfer-encoding' not in result.headers_lower)
assert 'transfer-encoding' not in result.headers_lower
def test_unicode_raises_error(self):
def wsgi_app(environ, start_response):
@@ -1119,7 +1119,7 @@ class TestHttpd(_TestBase):
result = read_http(sock)
self.assertEqual(result.status, 'HTTP/1.1 500 Internal Server Error')
self.assertEqual(result.headers_lower['connection'], 'close')
self.assert_('unicode' in result.body)
assert 'unicode' in result.body
def test_path_info_decoding(self):
def wsgi_app(environ, start_response):
@@ -1133,8 +1133,8 @@ class TestHttpd(_TestBase):
fd.flush()
result = read_http(sock)
self.assertEqual(result.status, 'HTTP/1.1 200 OK')
self.assert_('decoded: /a*b@@#3' in result.body)
self.assert_('raw: /a*b@%40%233' in result.body)
assert 'decoded: /a*b@@#3' in result.body
assert 'raw: /a*b@%40%233' in result.body
def test_ipv6(self):
try:
@@ -1174,7 +1174,7 @@ class TestHttpd(_TestBase):
self.assertEqual(result1.status, 'HTTP/1.1 500 Internal Server Error')
self.assertEqual(result1.body, '')
self.assertEqual(result1.headers_lower['connection'], 'close')
self.assert_('transfer-encoding' not in result1.headers_lower)
assert 'transfer-encoding' not in result1.headers_lower
# verify traceback when debugging enabled
self.spawn_server(debug=True)
@@ -1185,11 +1185,11 @@ class TestHttpd(_TestBase):
fd.flush()
result2 = read_http(sock)
self.assertEqual(result2.status, 'HTTP/1.1 500 Internal Server Error')
self.assert_('intentional crash' in result2.body)
self.assert_('RuntimeError' in result2.body)
self.assert_('Traceback' in result2.body)
assert 'intentional crash' in result2.body
assert 'RuntimeError' in result2.body
assert 'Traceback' in result2.body
self.assertEqual(result2.headers_lower['connection'], 'close')
self.assert_('transfer-encoding' not in result2.headers_lower)
assert 'transfer-encoding' not in result2.headers_lower
def test_client_disconnect(self):
"""Issue #95 Server must handle disconnect from client in the middle of response
@@ -1315,7 +1315,7 @@ class IterableAlreadyHandledTest(_TestBase):
fd.flush()
response_line, headers = read_headers(sock)
self.assertEqual(response_line, 'HTTP/1.1 200 OK\r\n')
self.assert_('connection' not in headers)
assert 'connection' not in headers
fd.write('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n')
fd.flush()
result = read_http(sock)
@@ -1473,7 +1473,7 @@ class TestChunkedInput(_TestBase):
except eventlet.Timeout:
pass
else:
self.assert_(False)
assert False
self.yield_next_space = True
with eventlet.Timeout(.1):
@@ -1496,7 +1496,7 @@ class TestChunkedInput(_TestBase):
except eventlet.Timeout:
pass
else:
self.assert_(False)
assert False
def test_close_before_finished(self):
got_signal = []