summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoramajorek <devnull@localhost>2010-03-09 08:45:37 -0500
committeramajorek <devnull@localhost>2010-03-09 08:45:37 -0500
commit37e992ceeea780f77674ef303d2d248b5db82c65 (patch)
treecb81d746c0b7176d92ec5e226761932a578e73b5 /tests
parentfcafbbf322c3c38079bf05ab21db0b7a3139e867 (diff)
downloadeventlet-37e992ceeea780f77674ef303d2d248b5db82c65.tar.gz
py3k - corrections for deprecation warnings reported by python2.6 -3.
- integer division - repr instead of ` Added __hash__ to speedy Proxy funtions - 3.x requires __hash__ if __eq__ is defined. Found problem with comparing two proxy objects.
Diffstat (limited to 'tests')
-rw-r--r--tests/convenience_test.py4
-rw-r--r--tests/hub_test.py2
-rw-r--r--tests/parse_results.py2
-rw-r--r--tests/saranwrap_test.py1
-rw-r--r--tests/test__greenness.py2
-rw-r--r--tests/test__refcount.py4
-rw-r--r--tests/test__twistedutil.py2
-rw-r--r--tests/test__twistedutil_protocol.py4
-rw-r--r--tests/timeout_test_with_statement.py2
-rw-r--r--tests/tpool_test.py12
10 files changed, 22 insertions, 13 deletions
diff --git a/tests/convenience_test.py b/tests/convenience_test.py
index a3be65f..64aba0a 100644
--- a/tests/convenience_test.py
+++ b/tests/convenience_test.py
@@ -30,7 +30,7 @@ class TestServe(LimitedTestCase):
# tests that the server closes the client sock on handle() exception
def crasher(sock,addr):
sock.recv(1024)
- 0/0
+ 0//0
l = eventlet.listen(('localhost', 0))
gt = eventlet.spawn(eventlet.serve, l, crasher)
@@ -44,7 +44,7 @@ class TestServe(LimitedTestCase):
def crasher(sock,addr):
sock.recv(1024)
sock.close()
- 0/0
+ 0//0
l = eventlet.listen(('localhost', 0))
gt = eventlet.spawn(eventlet.serve, l, crasher)
diff --git a/tests/hub_test.py b/tests/hub_test.py
index 7629be6..ccfc5c4 100644
--- a/tests/hub_test.py
+++ b/tests/hub_test.py
@@ -51,7 +51,7 @@ class TestExceptionInMainloop(LimitedTestCase):
assert delay >= DELAY*0.9, 'sleep returned after %s seconds (was scheduled for %s)' % (delay, DELAY)
def fail():
- 1/0
+ 1//0
hubs.get_hub().schedule_call_global(0, fail)
diff --git a/tests/parse_results.py b/tests/parse_results.py
index 62feac5..44bd786 100644
--- a/tests/parse_results.py
+++ b/tests/parse_results.py
@@ -46,7 +46,7 @@ def parse_unittest_output(s):
fail = int(fail or '0')
error = int(error or '0')
else:
- assert ok_match, `s`
+ assert ok_match, repr(s)
timeout_match = re.search('^===disabled because of timeout: (\d+)$', s, re.M)
if timeout_match:
timeout = int(timeout_match.group(1))
diff --git a/tests/saranwrap_test.py b/tests/saranwrap_test.py
index b96a08b..ba71c20 100644
--- a/tests/saranwrap_test.py
+++ b/tests/saranwrap_test.py
@@ -82,7 +82,6 @@ class TestSaranwrap(LimitedTestCase):
self.assertEqual(1, prox['a'])
self.assertEqual(str(my_object), str(prox))
self.assertEqual('saran:' + repr(my_object), repr(prox))
- self.assertEqual('saran:' + `my_object`, `prox`)
@skip_on_windows
@skip_with_pyevent
diff --git a/tests/test__greenness.py b/tests/test__greenness.py
index 65ef8b4..27f507d 100644
--- a/tests/test__greenness.py
+++ b/tests/test__greenness.py
@@ -40,7 +40,7 @@ class TestGreenness(unittest.TestCase):
urllib2.urlopen('http://127.0.0.1:%s' % self.port)
assert False, 'should not get there'
except urllib2.HTTPError, ex:
- assert ex.code == 501, `ex`
+ assert ex.code == 501, repr(ex)
self.assertEqual(self.server.request_count, 1)
if __name__ == '__main__':
diff --git a/tests/test__refcount.py b/tests/test__refcount.py
index 553971a..8a66f3c 100644
--- a/tests/test__refcount.py
+++ b/tests/test__refcount.py
@@ -31,7 +31,7 @@ def handle_request(s, raise_on_timeout):
return
#print 'handle_request - accepted'
res = conn.recv(100)
- assert res == 'hello', `res`
+ assert res == 'hello', repr(res)
#print 'handle_request - recvd %r' % res
res = conn.send('bye')
#print 'handle_request - sent %r' % res
@@ -46,7 +46,7 @@ def make_request(port):
res = s.send('hello')
#print 'make_request - sent %s' % res
res = s.recv(100)
- assert res == 'bye', `res`
+ assert res == 'bye', repr(res)
#print 'make_request - recvd %r' % res
#s.close()
diff --git a/tests/test__twistedutil.py b/tests/test__twistedutil.py
index e7c56fc..afa9ee5 100644
--- a/tests/test__twistedutil.py
+++ b/tests/test__twistedutil.py
@@ -29,7 +29,7 @@ class Test(unittest.TestCase):
def test_block_on_already_succeed(self):
d = defer.succeed('hey corotwine')
res = block_on(d)
- assert res == 'hey corotwine', `res`
+ assert res == 'hey corotwine', repr(res)
@requires_twisted
def test_block_on_already_failed(self):
diff --git a/tests/test__twistedutil_protocol.py b/tests/test__twistedutil_protocol.py
index f533d89..53381f4 100644
--- a/tests/test__twistedutil_protocol.py
+++ b/tests/test__twistedutil_protocol.py
@@ -160,7 +160,7 @@ class TestGreenTransport_bufsize1(TestGreenTransport):
# self.conn.write('hello\r\n')
# sleep(DELAY*1.5) # make sure the rest of data arrives
# try:
-# 1/0
+# 1//0
# except:
# #self.conn.loseConnection(failure.Failure()) # does not work, why?
# spawn(self.conn._queue.send_exception, *sys.exc_info())
@@ -176,7 +176,7 @@ class TestGreenTransport_bufsize1(TestGreenTransport):
# self.assertEqual('you said hello. ', self.conn.recv())
# sleep(DELAY*1.5) # make sure the rest of data arrives
# try:
-# 1/0
+# 1//0
# except:
# #self.conn.loseConnection(failure.Failure()) # does not work, why?
# spawn(self.conn._queue.send_exception, *sys.exc_info())
diff --git a/tests/timeout_test_with_statement.py b/tests/timeout_test_with_statement.py
index 7ce29b7..48fe0b5 100644
--- a/tests/timeout_test_with_statement.py
+++ b/tests/timeout_test_with_statement.py
@@ -51,7 +51,7 @@ class Test(LimitedTestCase):
pass
try:
- 1/0
+ 1//0
except:
try:
with Timeout(DELAY, sys.exc_info()[0]):
diff --git a/tests/tpool_test.py b/tests/tpool_test.py
index bd61e79..bb954a7 100644
--- a/tests/tpool_test.py
+++ b/tests/tpool_test.py
@@ -74,7 +74,6 @@ class TestTpool(LimitedTestCase):
self.assertEqual(1, prox['a'])
self.assertEqual(str(my_object), str(prox))
self.assertEqual(repr(my_object), repr(prox))
- self.assertEqual(`my_object`, `prox`)
@skip_with_pyevent
def test_wrap_module_class(self):
@@ -94,6 +93,17 @@ class TestTpool(LimitedTestCase):
self.assert_(exp1 != exp3)
@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?
+ self.assertEqual(hash(prox1), hash(prox2))
+ proxList = tpool.Proxy([])
+ self.assertRaises(TypeError, hash, proxList)
+
+ @skip_with_pyevent
def test_wrap_nonzero(self):
prox = tpool.Proxy(re)
exp1 = prox.compile('.')