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

The display symbol the colors in the error message. Instead of E I get \x1b[1m\x1b[31mE #4460

Open
AlexandrDragunkin opened this issue Nov 24, 2018 · 7 comments
Labels
platform: windows windows platform-specific problem topic: reporting related to terminal output and user-facing messages and errors type: bug problem that needs to be addressed

Comments

@AlexandrDragunkin
Copy link

I get the error symbol in the conEMU console incorrectly displayed.

In CMD

(venv35) ...pytest_simple_rapid_effectiv\bopytest-code\code\ch4\cache>pip list
Package        Version
-------------- -------
attrs          18.1.0
Click          7.0
colorama       0.3.9
more-itertools 4.1.0
pip            18.1
pluggy         0.6.0
py             1.5.3
pytest         3.5.1
setuptools     39.0.1
six            1.11.0
tinydb         3.11.1
wheel          0.31.0
xlsxwriter     1.0.4

(venv35) ....pytest_simple_rapid_effectiv\bopytest-code\code\ch4\cache>pytest --version
This is pytest version 3.5.1, imported from c:\venv35\lib\site-packages\pytest.py

(venv35) ...pytest_simple_rapid_effectiv\bopytest-code\code\ch4\cache>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32

>>> import sys
>>> sys.platform
'win32'
>>>

OS Windows 7 Home Premium SP1 x64

@asottile asottile added type: bug problem that needs to be addressed topic: reporting related to terminal output and user-facing messages and errors platform: windows windows platform-specific problem labels Nov 24, 2018
@asottile
Copy link
Member

good C:\BOOKS\pytest_simple_rapid_effectiv\ book by the way ;)

looks like we're manually using posix escapes on windows when we should be using our colorizing helpers. Should be a pretty easy fix

oddly enough, I'm having a hard time reproducing this! What version of windows are you using? (looks like window 7?)

@nicoddemus
Copy link
Member

looks like we're manually using posix escapes on windows when we should be using our colorizing helpers.

Hmm seems unlikely, I (and nearly all my colleagues) use Windows daily, we would have noticed that by now.

Perhaps we can produce a simple snippet using colorama for @AlexandrDragunkin to run, and see if it displays the same issue?

@AlexandrDragunkin
Copy link
Author

AlexandrDragunkin commented Nov 25, 2018

asottile, OS Windows 7 Home Premium SP1 x64

Perhaps this error manifested itself after some kind of Windows update.

I have old screenshots of sessions and 25 ... October 30th everything was in order. What could have changed this month ?! In addition to Windows updates nothing.

@AlexandrDragunkin
Copy link
Author

I wrote a simple code test_err_io.py

import py
import sys

tw = py.io.TerminalWriter(sys.stderr)
msg = 'Simulate an error message'
tw.line("ERROR: {}\n".format(msg), red=True)

line = 'E   Another pseudo error'
red = line.startswith("E   ")
tw.line(line, bold=True, red=red)

It displayed correctly.

@AlexandrDragunkin
Copy link
Author

Amazing! However, symbols appear in the console window, although they are not in the displayed message.

@AlexandrDragunkin
Copy link
Author

AlexandrDragunkin commented Nov 25, 2018

Personally, I have The error appears only on this test

At performance

$ pytest -q --lf -l test_few_failures.py

There is a non-Unicode character in the output string. Perhaps this is the reason?
I checked the previous tests from the 3rd part of the book are displayed correctly.

@AlexandrDragunkin
Copy link
Author

The bug has been reproduced in the manual mode of the breakpoint in the debugger.
...\Lib\site-packages_pytest_code\code.py Line 931

>>> line = 'E   Another pseudo error'
>>> red = line.startswith("E   ")
>>> tw.line(line, bold=True, red=red)

I/O Ok!

>>> line = b'E        +  where 1.1e+25 \xc2\xb1 1.1e+19 = approx(1.1e+25)'.decode()
>>> red = line.startswith("E   ")
>>> tw.line(line, bold=True, red=red)

Getting the wrong display in CMD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: windows windows platform-specific problem topic: reporting related to terminal output and user-facing messages and errors type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

3 participants