-
Notifications
You must be signed in to change notification settings - Fork 74
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
Remove support for windows #46 - Gibberish stdout in windows #49
Conversation
@sontek, @Frozenball: Did you guys ever run pytest-sugar on Windows? I imagine it works in Cygwin with little to no work? |
I have never tried it on Windows, only on Mac/Linux enviroments.
|
I am currently running this in Windows 7 under GitBash with ConEmu. It is not displaying for me properly, and I also get gibberish from stdout. I can debug further if there is something else you'd like me to try. |
The gibberish appears because the Windows console used codepage 850 by default (MS-DOS Latin 1). Changing this to codepage 65001 = UTF-8 fixes the gibberish.
Mind you: the actual characters that appear also depend on the console font that is used, and the console environment. With font Lucida console and the alternative "cmder" console, I see pretty decent py.test output: |
Then we should probably add this in the troubleshooting part of the documentation. |
Let's add this to documentation |
Just to elaborate on this for other Windows users: I am using the git bash on Windows together with ConEmu and had struggles to make this work. Setting the codepage in a git bash will only work with a small change: This however will be recognized as Don't forget to first: import codecs
codecs.register(lambda name: codecs.lookup('utf-8')
if name == 'cp65001' else None)
import colorama
colorama.init() Some special characters still seem to not be recognized, but at least the progress bars look ok. |
FYI I have this problem when running tests inside a docker container. Container is running ubuntu 16, local is macOS. |
Are we sure it's pytest-sugar issue and not a problem in Docker etc.? |
Thanks for responding @Frozenball It's definitely coincident with pytest-sugar - it was fine before, the gibberish when pytest-sugar was installed, then fine when reverted... But it might be because Docker can't display complex stdout, or something else that's unavoidable. I'm less familiar with the mechanics there |
For slightly better Windows support, you may want to consider switching the dependency from termcolor to colorama, which should provide the same features, but, as mentioned in #49 (comment), can additionally preprocess ANSI color codes on Windows (see e.g. Description at https://pypi.org/project/colorama/). |
Remove support for windows #46