Skip to content

Commit

Permalink
Merge pull request #415 from astrofrog/fix-test-visual
Browse files Browse the repository at this point in the history
Fix visual tests with solara
  • Loading branch information
astrofrog authored Dec 5, 2023
2 parents bc5ffdb + 6284cf1 commit 85ef4ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 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
3 changes: 0 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 85ef4ac

Please sign in to comment.