Skip to content

calling capture.resume_global_capture() changes the used terminal width #13322

Open
@15r10nk

Description

@15r10nk

I have to suspend the global capture, because I ask the user for some user input in my pytest plugin.
But this leads to a changed terminal width.

conftest.py

import pytest
import shutil


@pytest.hookimpl(trylast=True)
def pytest_sessionfinish(session):
    capture = session.config.pluginmanager.getplugin("capturemanager")
    capture.suspend_global_capture(in_=True)

    # some code to read user input

    print(shutil.get_terminal_size())
    capture.resume_global_capture()
    print(shutil.get_terminal_size())

Image

The === in the no tests ran line are shorter than above and the result of get_terminal_size changed.

pytest: 8.3.5
os: Debian

I performed this test in a directory that only contained the specified file conftest.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: capturerelated to the capture builtin plugintype: 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