From 4ecce313adb074412f6ba1a6995fead165646a23 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 10 Sep 2023 09:34:18 -0300 Subject: [PATCH] Force terminal width when running tests Related to #11423 --- testing/conftest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testing/conftest.py b/testing/conftest.py index 926a1d5d3..06116fee4 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -22,6 +22,15 @@ if sys.gettrace(): 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(wrapper=True, tryfirst=True) def pytest_collection_modifyitems(items) -> Generator[None, None, None]: """Prefer faster tests.