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

Ensure tox gets proper language settings. #276

Closed
wants to merge 1 commit into from

Conversation

nvtkaszpir
Copy link
Contributor

If LC_ALL is not passed then the interpreter will assume it is C
(which causes the interpreter to use ASCII). This, in turn, causes
the unicode in various places to trigger a UnicodeDecodeError
exception.

CI workers have that locale set by default.
Some people do not have that locale setting set properly.

If LC_ALL is not passed then the interpreter will assume it is C
(which causes the interpreter to use ASCII). This, in turn, causes
the unicode in various places to trigger a UnicodeDecodeError
exception.

CI workers have that locale set by default.
Some people do not have that locale setting set properly.
@asottile
Copy link
Member

A couple things:

  • you've got tabs ;)
  • I actually think that assuming a UTF-8 locale is probably a bug, if there's things that are failing they should probably get fixed? Do you have some specific stacktraces here -- I imagine they'd make decent bug reports :)
  • I think LANG is probably a better catchall than LC_ALL (iirc, LANG overrides all of the others)

@nvtkaszpir
Copy link
Contributor Author

  • argh...
  • example error
_______________________________________________________________________________________________________ test_readme_contains_all_hooks ________________________________________________________________________________________________________

    def test_readme_contains_all_hooks():
>       readme_contents = io.open('README.md').read()

tests/readme_test.py:10: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <encodings.ascii.IncrementalDecoder object at 0x00000000050dcaa0>
input = "[![Build Status](https://travis-ci.org/pre-commit/pre-commit-hooks.svg?branch=master)](https://travis-ci.org/pre-comm...d like to use these hooks, they're also available as a standalone\npackage.\n\nSimply `pip install pre-commit-hooks`\n"
final = 1

    def decode(self, input, final=False):
>       return codecs.ascii_decode(input, self.errors)[0]
E       UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1828: ordinal not in range(128)

.tox/pypy/lib-python/2.7/encodings/ascii.py:26: UnicodeDecodeError

  • they work in the same way, but LC_ALL is processed in the first place, see man 7 locale. If you suggest to stick to LANG then OK.

@asottile
Copy link
Member

Ah indeed! Looks to me like a buggy test, I believe this fixes it? #277

@nvtkaszpir
Copy link
Contributor Author

Yep.
So my PR is no longer required. :)

@nvtkaszpir nvtkaszpir closed this Mar 26, 2018
@nvtkaszpir nvtkaszpir reopened this Mar 26, 2018
@nvtkaszpir
Copy link
Contributor Author

nvtkaszpir commented Mar 26, 2018

Hm not so fast.
Looks like it is needed also in other places, for example:
autopep8-wrapper
check-docstrings-first
reorder-python-imports

@nvtkaszpir nvtkaszpir mentioned this pull request Mar 26, 2018
@asottile
Copy link
Member

via #279 -- thanks again :D

@asottile asottile closed this Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants