You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where as running it as part of a Django test case I get the following from the first print:
/дÑ�лÑ�Ñ�нйÑ
Followed by the exception:
File "/code/frontend/tests/test_views.py", line 55, in test_event
print req.path
File "/virtualenv/frontend/local/lib/python2.7/site-packages/webob/request.py", line 485, in path
bpath = bytes_(self.path_info, self.url_encoding)
File "/virtualenv/frontend/local/lib/python2.7/site-packages/webob/descriptors.py", line 68, in fget
return req.encget(key, encattr=encattr)
File "/virtualenv/frontend/local/lib/python2.7/site-packages/webob/request.py", line 175, in encget
return val.decode(encoding)
File "/virtualenv/frontend/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-16: ordinal not in range(128)
I get that this is probably some weird configuration with my test suite, however both run via the same method in the same environment (Django's manage.py test vs manage.py shell) and so I'm struggling to identify what's different. We're also running a ton of other unicode related tests without issue.
Thanks for any light shed on this.
The text was updated successfully, but these errors were encountered:
carn1x
changed the title
BaseRequest.url gives UnicodeDecodeError in test run, but not in shell
BaseRequest.url gives UnicodeEncodeError in test run, but not in shell
Jun 8, 2017
Ahh thanks very much. I was actually aiming to fix a larger issue, and mistakenly drilled down to thinking webob was the problem. Eliminating unicode_literals however absolves webob and shifts the issue more towards webtest / django-webtest.
Take the following code:
If I run this via a django shell, I get:
Where as running it as part of a Django test case I get the following from the first print:
Followed by the exception:
I get that this is probably some weird configuration with my test suite, however both run via the same method in the same environment (Django's
manage.py test
vsmanage.py shell
) and so I'm struggling to identify what's different. We're also running a ton of other unicode related tests without issue.Thanks for any light shed on this.
The text was updated successfully, but these errors were encountered: