Force terminal width when running tests (#11425) (#11432) · pytest-dev/pytest@f8bb857 (original) (raw)

Original file line number Diff line number Diff line change
@@ -21,6 +21,15 @@ def restore_tracing():
21 21 sys.settrace(orig_trace)
22 22
23 23
24 +@pytest.fixture(autouse=True)
25 +def set_column_width(monkeypatch: pytest.MonkeyPatch) -> None:
26 +"""
27 + Force terminal width to 80: some tests check the formatting of --help, which is sensible
28 + to terminal width.
29 + """
30 +monkeypatch.setenv("COLUMNS", "80")
31 +
32 +
24 33 @pytest.hookimpl(hookwrapper=True, tryfirst=True)
25 34 def pytest_collection_modifyitems(items):
26 35 """Prefer faster tests.