diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index 36ec3bfc83c3..a1f27fea577a 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -301,7 +301,7 @@ def test_lazy_linux_headless(): """ proc = subprocess.run([sys.executable, "-c", test_script], - env={"MPLBACKEND": ""}) + env={**os.environ, "MPLBACKEND": ""}) if proc.returncode: pytest.fail("The subprocess returned with non-zero exit status " f"{proc.returncode}.")