Skip to content

Linux terminal garbage when \x05 occurs in test output. #4397

@WloHu

Description

@WloHu
  • Include a detailed description of the bug or suggestion

After running my parameterized tests with -vvv there was a sequence of mixed ?1;2c and ^[[ characters in terminal promt and test output. It looks like in the screen snippet (output from given example code):
image

The reason is explained here and it occurs because character \x05 is interpreted in special way by terminal when running e.g. cat.

Also notice that \x05 character is missing but \xff is printed correctly.

I'm aware that may not be pytest issue but I don't know exacly which upstream should know about it. If you have any suggestions please tell me and I will report them there.

  • Minimal example if possible
    Test file which generates this output.
import pytest
import struct

@pytest.mark.parametrize('val, ex_bytes', [
    pytest.param(1, b'\x01', id="This doesn't test for \x05 presence."),
    (5, b'\x05'),
    (255, b'\xff'),
])
def test_b(val, ex_bytes):
    assert struct.pack('B', val) == ex_bytes

  • pip list of the virtual environment you are using
    Python 3.6.2
    pytest 3.9.1

  • pytest and operating system versions
    ArchLinux, 4.12.13-1-ARCH
    TERM=rxvt-unicode-256color

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: criticalgrave problem or usability issue that affects lots of userstopic: parametrizerelated to @pytest.mark.parametrizetype: 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