Closed manuphatak closed 9 years ago
Hi @bionikspoon
I experienced a similar problem with the latest tox version and click on Python3. Maybe the solution we came up with is working for you too. Please have a look into the gist included in the PR. :smile:
I'm seeing the same issue with both the python -m unittest
test runner and nosetests
.
I pushed a change that makes a stream with encoding set to None
become an ascii
stream. This will not actually fix the issue but at least it will not fail with a type error. This probably happens because the environment is misconfigured.
I have seen with tox 2.0 (where it sanitizes the environment in which tests are run) many unicode Python 3 issues. Python 3 (at least on NixOS) becomes unable to look up the correct encoding and falls back to ascii, which click then rejects as broken.
I worked around this by adding passenv = LANG LOCALE_ARCHIVE
to tox.ini
. I am not sure if this would be any different on other distributions.
This seems to be a fairly recent problem with tox, Werkzeug and other software hit similar problems.
Yes, I believe it was a new feature in tox 2.0, release a couple of weeks ago.
@sjagoe Yes, indeed.
Feel free to join the discussion on the pytest-dev mailinglist.
:information_source: https://mail.python.org/pipermail/pytest-dev/2015-May/002950.html
This might be fixed as of tox 2.0.2, see https://bitbucket.org/hpk42/tox/issue/247/pass-through-lang-environment-variable-by
Python Versions: 3.2, 3.3, and 3.4, on Linux.
is_ascii_encoding
is setup to catch aLookupError
, but I'm getting aTypeError
instead:This originates from calls to
.echo
and.secho
. Encoding is returningNone
. Then the property.name
is called on thatNone
.I've tried setting the environment variables, with no effect, as described here: http://click.pocoo.org/4/python3/#python3-surrogates
My app works just fine, but this is failing my tests.
Here's the monkeypatch hack I've been using for py.test (for anyone else who runs into this): edit: just to be clear, this fixes the problem:
An example traceback (without the patch):