summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2012-08-15 14:29:40 +0200
committerFlorian Apolloner <florian@apolloner.eu>2012-08-15 14:29:40 +0200
commitc1584890b1764831309eba393eba74afba39487d (patch)
tree1c466cc72b56ea688b50efc7bac5f20183aee7eb
parentf2fff84bc3e85b9c9c132dec614e8b293df8f6bb (diff)
[py3] Properly encode hashlib.md5 and zip.compress args in the tests.
-rw-r--r--tests/regressiontests/cache/tests.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py
index 33840d65d7..ce6b7e74cd 100644
--- a/tests/regressiontests/cache/tests.py
+++ b/tests/regressiontests/cache/tests.py
@@ -364,7 +364,7 @@ class BaseCacheTests(object):
# Binary strings should be cacheable
from zlib import compress, decompress
value = 'value_to_be_compressed'
- compressed_value = compress(value)
+ compressed_value = compress(value.encode())
# Test set
self.cache.set('binary1', compressed_value)
@@ -988,7 +988,7 @@ class FileBasedCacheTests(unittest.TestCase, BaseCacheTests):
"""Test that keys are hashed into subdirectories correctly"""
self.cache.set("foo", "bar")
key = self.cache.make_key("foo")
- keyhash = hashlib.md5(key).hexdigest()
+ keyhash = hashlib.md5(key.encode()).hexdigest()
keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
self.assertTrue(os.path.exists(keypath))
@@ -998,7 +998,7 @@ class FileBasedCacheTests(unittest.TestCase, BaseCacheTests):
"""
self.cache.set("foo", "bar")
key = self.cache.make_key("foo")
- keyhash = hashlib.md5(key).hexdigest()
+ keyhash = hashlib.md5(key.encode()).hexdigest()
keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
self.assertTrue(os.path.exists(keypath))