Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed test_chinese_user_agent/test_russian_cp1251_user_agent with Python 2.7.10 #232

Closed
felixonmars opened this issue Sep 19, 2015 · 3 comments

Comments

@felixonmars
Copy link
Contributor

I am getting the test failures with Python 2.7.10, while with Python 3.4.3 it works fine. I have tried to set LC_ALL to en_US.UTF-8 but it doesn't help. Any hints?

More package versions:
flask-login 0.3.0
flask 0.10.1
werkzeug 0.10.4
blinker 1.4
nose 1.3.7

ERROR: test_chinese_user_agent (test_login.LoginTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-flask-login/src/flask-login-py2/test_login.py", line 1044, in test_chinese_user_agent
    result = c.get('/', headers=[('User-Agent', u'中文')])
  File "/usr/lib/python2.7/site-packages/werkzeug/test.py", line 774, in get
    return self.open(*args, **kw)
  File "/usr/lib/python2.7/site-packages/flask/testing.py", line 108, in open
    follow_redirects=follow_redirects)
  File "/usr/lib/python2.7/site-packages/werkzeug/test.py", line 732, in open
    environ = args[0].get_environ()
  File "/usr/lib/python2.7/site-packages/werkzeug/test.py", line 575, in get_environ
    for key, value in self.headers.to_wsgi_list():
  File "/usr/lib/python2.7/site-packages/werkzeug/datastructures.py", line 1194, in to_wsgi_list
    return [(to_native(k), v.encode('latin1')) for k, v in self]
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

======================================================================
ERROR: test_russian_cp1251_user_agent (test_login.LoginTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/python-flask-login/src/flask-login-py2/test_login.py", line 1052, in test_russian_cp1251_user_agent
    response = c.get('/', headers=headers)
  File "/usr/lib/python2.7/site-packages/werkzeug/test.py", line 774, in get
    return self.open(*args, **kw)
  File "/usr/lib/python2.7/site-packages/flask/testing.py", line 108, in open
    follow_redirects=follow_redirects)
  File "/usr/lib/python2.7/site-packages/werkzeug/test.py", line 732, in open
    environ = args[0].get_environ()
  File "/usr/lib/python2.7/site-packages/werkzeug/test.py", line 575, in get_environ
    for key, value in self.headers.to_wsgi_list():
  File "/usr/lib/python2.7/site-packages/werkzeug/datastructures.py", line 1194, in to_wsgi_list
    return [(to_native(k), v.encode('latin1')) for k, v in self]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xdf in position 0: ordinal not in range(128)
@maxcountryman
Copy link
Owner

Seems like a bug in Python 2.7.10; all tests pass in 2.7.9.

@dev-zero
Copy link

reproduced with python 2.7.11

@maxcountryman
Copy link
Owner

Python 2.x is EOL; closing.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants