diff --git a/holoviews/core/options.py b/holoviews/core/options.py index 1bb4a7a127..35f7b4e79a 100644 --- a/holoviews/core/options.py +++ b/holoviews/core/options.py @@ -1253,7 +1253,7 @@ def info(cls, obj, ansi=True, backend='matplotlib', visualization=True, parameterized_class = (isinstance(obj,type) and issubclass(obj,param.Parameterized)) info = None - if parameterized_object or parameterized_class: + if InfoPrinter.store and (parameterized_object or parameterized_class): info = InfoPrinter.info(obj, ansi=ansi, backend=backend, visualization=visualization, pattern=pattern, elements=elements) diff --git a/holoviews/tests/util/test_help.py b/holoviews/tests/util/test_help.py index 9b19751686..4b7945b8a2 100644 --- a/holoviews/tests/util/test_help.py +++ b/holoviews/tests/util/test_help.py @@ -9,3 +9,15 @@ def test_help_pattern(capsys): hv.help(hv.Curve, pattern='border') captured = capsys.readouterr() assert '\x1b[43;1;30mborder\x1b[0m' in captured.out + + +@pytest.mark.usefixtures("bokeh_backend") +def test_help_pattern_no_ipython(capsys): + info_store = hv.core.pprint.InfoPrinter.store + try: + hv.core.pprint.InfoPrinter.store = None + hv.help(hv.Curve) + captured = capsys.readouterr() + assert captured.out.startswith('Help on class Curve') + finally: + hv.core.pprint.InfoPrinter.store = info_store