diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py index 59456cb094a..eb0ec86c73e 100644 --- a/src/sage/repl/display/formatter.py +++ b/src/sage/repl/display/formatter.py @@ -140,8 +140,7 @@ def format(self, obj, include=None, exclude=None): TESTS:: sage: import os - sage: from sage.env import SAGE_EXTCODE - sage: example_png = os.path.join(SAGE_EXTCODE, 'doctest', 'rich_output', 'example.png') + sage: import importlib.resources sage: from sage.repl.rich_output.backend_ipython import BackendIPython sage: backend = BackendIPython() sage: shell = get_test_shell() @@ -149,7 +148,8 @@ def format(self, obj, include=None, exclude=None): sage: shell.run_cell('get_ipython().display_formatter') sage: shell.run_cell('from IPython.display import Image') - sage: shell.run_cell('ipython_image = Image("{0}")'.format(example_png)) + sage: with importlib.resources.path(sage.repl.rich_output, 'example.png') as example_png: + ....: shell.run_cell('ipython_image = Image("{0}")'.format(example_png)) sage: shell.run_cell('ipython_image') sage: shell.run_cell('get_ipython().display_formatter.format(ipython_image)')