Fix test_logger in Python 3.2.

This commit is contained in:
Berker Peksag 2015-07-08 12:38:14 +03:00
parent da37bcfebe
commit dddfcb2826
2 changed files with 4 additions and 2 deletions

View File

@ -378,7 +378,9 @@ class Logger(object):
auth = http_auth.split(" ", 1)
if len(auth) == 2:
try:
auth = base64.b64decode(auth[1].strip())
# b64decode doesn't accept unicode in Python < 3.3
# so we need to convert it to a byte string
auth = base64.b64decode(auth[1].strip().encode('utf-8'))
if PY3: # b64decode returns a byte string in Python 3
auth = auth.decode('utf-8')
auth = auth.split(":", 1)

View File

@ -4,7 +4,7 @@ skipsdist = True
[testenv]
usedevelop = True
commands = py.test tests/
commands = py.test {posargs:tests/}
deps =
-rrequirements_test.txt
py26: unittest2