From f8bb8572fed8627946bfc82819d24b138d587257 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 11 Sep 2023 09:48:22 -0300 Subject: [PATCH] Force terminal width when running tests (#11425) (#11432) Related to #11423 (cherry picked from commit 241f2a890e3fb3f83eac807de0b4ad00510c7f65) --- testing/conftest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testing/conftest.py b/testing/conftest.py index 8e77fcae5ab..2a3ce5203d9 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -21,6 +21,15 @@ def restore_tracing(): sys.settrace(orig_trace) +@pytest.fixture(autouse=True) +def set_column_width(monkeypatch: pytest.MonkeyPatch) -> None: + """ + Force terminal width to 80: some tests check the formatting of --help, which is sensible + to terminal width. + """ + monkeypatch.setenv("COLUMNS", "80") + + @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_collection_modifyitems(items): """Prefer faster tests.