8000 TST: Ensure that `backend_fallback` is enabled during test case · matplotlib/matplotlib@2b61d2b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b61d2b

Browse files
committed
TST: Ensure that backend_fallback is enabled during test case
1 parent 6b333ac commit 2b61d2b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/tests/test_rcparams.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,16 @@ def test_backend_fallback_headless_invalid_backend(tmp_path):
539539

540540
@pytest.mark.skipif(sys.platform != "linux", reason="Linux only")
541541
def test_backend_fallback_headless_auto_backend(tmp_path):
542+
# specify a headless mpl environment, but request a graphical (tk) backend
542543
env = {**os.environ,
543544
"DISPLAY": "", "WAYLAND_DISPLAY": "",
544545
"MPLBACKEND": "TkAgg", "MPLCONFIGDIR": str(tmp_path)}
545-
# plotting should succeed using auto-backend selection in a headless environment
546+
547+
# allow fallback to an available interactive backend explicitly in configuration
548+
rc_path = tmp_path / "matplotlibrc"
549+
rc_path.write_text("backend_fallback: true")
550+
551+
# plotting should succeed, by falling back to use the generic agg backend
546552
backend = subprocess_run_for_testing(
547553
[sys.executable, "-c",
548554
"import matplotlib.pyplot;"

0 commit comments

Comments
 (0)
0