Skip to content

Commit

Permalink
Fix visual tests with solara
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Dec 5, 2023
1 parent bc5ffdb commit 312dbbe
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions glue_jupyter/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 312dbbe

Please sign in to comment.