From 3fde65eeae0019ec0971442886331fb7ffbcdffb Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 27 Jul 2015 18:08:10 +0200 Subject: More Python 3 fixes * Port set_multi() to Python 3 * Port delete_multi() to Python 3 * Fix _get_server() on Python 3 when the connection to the first server fails: encode to ASCII before calling serverHashFunction. * Fix expect(): don't decode line on Python 3, return the raw line * Add more unit tests * tox now also runs unit tests * Explicit the encoding when calling str.encode(): use 'utf-8' * test_memcache: close sockets in tearDown() * test_get_unknown_value(): delete the key to ensure that it doesn't exist --- tests/test_setmulti.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/test_setmulti.py') diff --git a/tests/test_setmulti.py b/tests/test_setmulti.py index 2f7108a..39d43c9 100644 --- a/tests/test_setmulti.py +++ b/tests/test_setmulti.py @@ -53,18 +53,20 @@ class test_Memcached_Set_Multi(unittest.TestCase): self.old_socket = socket.socket socket.socket = FakeSocket + self.mc = memcache.Client(['memcached'], debug=True) + def tearDown(self): socket.socket = self.old_socket def test_Socket_Disconnect(self): - client = memcache.Client(['memcached'], debug=True) mapping = {'foo': 'FOO', 'bar': 'BAR'} - bad_keys = client.set_multi(mapping) + bad_keys = self.mc.set_multi(mapping) self.assertEqual(sorted(bad_keys), ['bar', 'foo']) if DEBUG: print('set_multi({0!r}) -> {1!r}'.format(mapping, bad_keys)) + if __name__ == '__main__': unittest.main() -- cgit v1.2.1