Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0fae373

Browse files
committed
Fix test_lazy_imports in presence of $MPLBACKEND or matplotlibrc.
$MPLBACKEND or the matplotlibrc can make matplotlib load a nondefault backend (cough cough, mplcairo) by default which then makes the test fail. Overwrite these in the test.
1 parent 3320e23 commit 0fae373

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

lib/matplotlib/tests/test_basic.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import builtins
2+
import os
23
import subprocess
34
import sys
45
import textwrap
@@ -50,8 +51,6 @@ def test_lazy_imports():
5051
assert 'urllib.request' not in sys.modules
5152
""")
5253

53-
subprocess.check_call([
54-
sys.executable,
55-
'-c',
56-
source
57-
])
54+
subprocess.check_call(
55+
[sys.executable, '-c', source],
56+
env={**os.environ, "MPLBACKEND": "", "MATPLOTLIBRC": os.devnull})

0 commit comments

Comments
 (0)