From 98e7d7eeb713bd66b54a52d494f8aca4b0b3d10c Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Mon, 6 Aug 2018 13:01:10 -0700 Subject: [PATCH] Fix test_info_repr #21746 --- pandas/tests/io/formats/test_format.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 76bdf141ec828..c19f8e57f9ae7 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -1586,8 +1586,12 @@ def test_repr_html_long_and_wide(self): assert '...' in df._repr_html_() def test_info_repr(self): + # GH#21746 For tests inside a terminal (i.e. not CI) we need to detect + # the terminal size to ensure that we try to print something "too big" + term_width, term_height = get_terminal_size() + max_rows = 60 - max_cols = 20 + max_cols = 20 + (max(term_width, 80) - 80) // 4 # Long h, w = max_rows + 1, max_cols - 1 df = DataFrame({k: np.arange(1, 1 + h) for k in np.arange(w)})