Skip to content

Pytest debug option "--debug" has problems to write non ASCII characters #7781

@Tiarles

Description

@Tiarles
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Introduction

In my tests, I have some tests to check nonascii names for files. The test consists in import and compiles theses tests and everything works fine, but at the moment that I try to take a look in the execution of the hooks using the pytest --debug option the execution fail because pytest debug can't write the ascii character present in the Node ID of these tests, returning a UnicodeEncodeError.

pip list command

aenum 2.2.4
alabaster 0.7.12
allure-pytest 2.8.10
allure-python-commons 2.8.10
appy 0.9.6
Arpeggio 1.9.2
atomicwrites 1.4.0
attrs 20.2.0
Babel 2.8.0
backcall 0.2.0
backports.functools-lru-cache 1.6.1
bcrypt 3.2.0
bitstruct 8.11.0
cached-property 1.5.1
cantools 32.16.0
certifi 2020.6.20
cffi 1.14.2
chardet 3.0.4
Click 7.0
colorama 0.4.3
control 0.8.3
cparser 0.1.3
cryptography 3.1
cycler 0.10.0
Cython 0.29.21
decorator 4.4.2
diskcache 5.0.3
docutils 0.14
dss-python 0.10.6
FMPy 0.2.14
future 0.18.2
idna 2.10
imagesize 1.2.0
iniconfig 1.0.1
ipython 7.18.1
ipython-genutils 0.2.0
jedi 0.14.1
Jinja2 2.11.2
kiwisolver 1.2.0
lark-parser 0.9.0
lxml 4.5.2
MarkupSafe 1.1.1
matplotlib 3.1.2
model-converter 1.4.4
more-itertools 8.5.0
npTDMS 0.23.0
numexpr 2.7.1
numpy 1.19.0
OpenDSSDirect.py 0.4.0
openpyxl 1.7.0
packaging 20.4
pandas 1.0.5
paramiko 2.7.1
parglare 0.10.0
parso 0.5.1
pathlib 1.0.1
Paver 1.3.4
PeakUtils 1.3.3
pickleshare 0.7.5
Pillow 7.2.0
pip 20.2.3
pluggy 0.13.1
prompt-toolkit 3.0.7
psutil 5.7.2
py 1.9.0
pycparser 2.20
pycryptodomex 3.9.8
pyFFTW 0.12.0
pygit2 1.2.1
Pygments 2.7.0
pyModbusTCP 0.1.8
PyNaCl 1.4.0
pyparsing 2.4.0
PyQt5 5.15.0
PyQt5-sip 12.8.1
pyqtgraph 0.11.0+gabfac52
PyQtWebEngine 5.15.0
pyserial 3.4
pytest 5.4.1
pytest-assume 2.2.0
python-can 3.3.3
python-dateutil 2.8.0
pytz 2019.1
pyusb 1.0.2
pywin32 228
pyzmq 19.0.1
QScintilla 2.11.4
requests 2.24.0
scipy 1.5.1
setuptools 47.1.0
sip 5.4.0
six 1.12.0
snowballstemmer 2.0.0
Sphinx 1.7.0
sphinxcontrib-programoutput 0.16
sphinxcontrib-serializinghtml 1.1.4
sphinxcontrib-websupport 1.2.4
tables 3.6.1
tabulate 0.8.3
textparser 0.23.0
textX 2.1.0
toml 0.10.1
traitlets 5.0.4
urllib3 1.25.10
wcwidth 0.2.5
wheel 0.35.1
win-inet-pton 1.1.0
windows-curses 2.1.0
wrapt 1.12.1
yapf 0.28.0

Pytest and OS versions

pytest-6.0.2 - Windows 10 (Home Edition)

A brief example

# In test_sample.py
def test4_чћшђ_čćšđ():
    assert True

# Called using ``pytest test_sample.py`` -> OK
# Called using ``pytest --debug test_sample.py`` -> UnicodeEncodeError

Conclusion

Any doubt about my explanation about this issue just ping me, Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions