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

Remove support for windows #46 - Gibberish stdout in windows #49

Closed
wants to merge 1 commit into from

Conversation

kman0
Copy link
Contributor

@kman0 kman0 commented Dec 4, 2014

Remove support for windows #46

@msabramo
Copy link
Collaborator

msabramo commented Dec 5, 2014

@sontek, @Frozenball: Did you guys ever run pytest-sugar on Windows?

I imagine it works in Cygwin with little to no work?

@Teemu
Copy link
Owner

Teemu commented Dec 5, 2014

I have never tried it on Windows, only on Mac/Linux enviroments.
On 5 Dec 2014 19:57, "Marc Abramowitz" notifications@github.com wrote:

@sontek https://github.com/sontek, @Frozenball
https://github.com/Frozenball: Did you guys ever run pytest-sugar on
Windows?

I imagine it works in Cygwin with little to no work?


Reply to this email directly or view it on GitHub
#49 (comment)
.

@Dog
Copy link

Dog commented Jun 22, 2015

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.

@wwwald
Copy link

wwwald commented Oct 8, 2015

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.

chcp 65001

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:
image

@Natim
Copy link
Contributor

Natim commented Oct 12, 2015

Then we should probably add this in the troubleshooting part of the documentation.

@Teemu
Copy link
Owner

Teemu commented Dec 24, 2016

Let's add this to documentation

@Teemu Teemu closed this Dec 24, 2016
@cb109
Copy link

cb109 commented Jan 4, 2017

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:
$ chcp.com 65001

This however will be recognized as cp65001 by python instead of the correct 65001 (at least on 2.7x), it seems to be a bug. We can map that to the correct codec though. Inside my top-level conftest.py I was able to produce decent output with the following adjustments:

Don't forget to first: $ pip install colorama

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.

@max-sixty
Copy link

FYI I have this problem when running tests inside a docker container. Container is running ubuntu 16, local is macOS.

@Teemu
Copy link
Owner

Teemu commented Feb 20, 2017

Are we sure it's pytest-sugar issue and not a problem in Docker etc.?

@max-sixty
Copy link

max-sixty commented Feb 20, 2017

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

@anntzer
Copy link

anntzer commented Mar 16, 2021

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/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants