diff --git a/glue_jupyter/conftest.py b/glue_jupyter/conftest.py index bf881d25..ddae2346 100644 --- a/glue_jupyter/conftest.py +++ b/glue_jupyter/conftest.py @@ -68,20 +68,31 @@ def app(dataxyz, datax, dataxz, data_volume, data_image): return app -ORIGINAL_DISPLAY = None +try: + import solara # noqa: F401 +except ImportError: + SOLARA_INSTALLED = False +else: + SOLARA_INSTALLED = True -def noop(*args, **kwargs): - pass +# Tweak IPython's display to not print out lots of __repr__s for widgets to +# standard output. However, if we are using solara, we shouldn't do this as +# it seems to cause issues. +if not SOLARA_INSTALLED: -def pytest_configure(config): - global ORIGINAL_DISPLAY - import IPython.display as idisp - ORIGINAL_DISPLAY = idisp.display - idisp.display = noop + ORIGINAL_DISPLAY = None + def noop(*args, **kwargs): + pass -def pytest_unconfigure(config): - import IPython.display as idisp - idisp.display = ORIGINAL_DISPLAY + def pytest_configure(config): + global ORIGINAL_DISPLAY + import IPython.display as idisp + ORIGINAL_DISPLAY = idisp.display + idisp.display = noop + + def pytest_unconfigure(config): + import IPython.display as idisp + idisp.display = ORIGINAL_DISPLAY diff --git a/tox.ini b/tox.ini index 191892e9..a2231aff 100644 --- a/tox.ini +++ b/tox.ini @@ -24,9 +24,6 @@ deps = notebooks: astroquery notebooks: pyyaml devdeps: git+https://github.com/glue-viz/glue - # Pin pydantic to 1.x for now: https://github.com/widgetti/solara/issues/187 - visual: pydantic<2 - visual: git+https://github.com/widgetti/solara extras = test: test notebooks: test