Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e9b8ea

Browse files
dopplershiftstory645
authored andcommitted
resolved conflict in pyplot, added elements to backend dict
1 parent e7d1218 commit 0e9b8ea

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

‎lib/matplotlib/pyplot.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,8 +2341,14 @@ def getname_val(identifier):
23412341
# requested, ignore rcParams['backend'] and force selection of a backend that
23422342
# is compatible with the current running interactive framework.
23432343
if (rcParams["backend_fallback"]
2344+
<<<<<<< HEAD
23442345
and dict.__getitem__(rcParams, "backend") in _interactive_bk
23452346
and _get_running_interactive_framework()):
2347+
=======
2348+
and dict.__getitem__(rcParams, "backend") in (
2349+
set(_interactive_bk) - {'WebAgg', 'nbAgg'})
2350+
and cbook._get_running_interactive_framework()):
2351+
>>>>>>> 126de7f92... Merge pull request #15512 from tacaswell/fix_webagg_fallback
23462352
dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel)
23472353
# Set up the backend.
23482354
switch_backend(rcParams["backend"])
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import subprocess
2+
import os
3+
import sys
4+
import pytest
5+
6+
7+
@pytest.mark.parametrize("backend", ["webagg", "nbagg"])
8+
def test_webagg_fallback(backend):
9+
if backend == "nbagg":
10+
pytest.importorskip("IPython")
11+
env = {}
12+
if os.name == "nt":
13+
env = dict(os.environ)
14+
else:
15+
env = {"DISPLAY": ""}
16+
17+
env["MPLBACKEND"] = backend
18+
19+
test_code = (
20+
"import os;"
21+
+ f"assert os.environ['MPLBACKEND'] == '{backend}';"
22+
+ "import matplotlib.pyplot as plt; "
23+
+ "print(plt.get_backend());"
24+
f"assert '{backend}' == plt.get_backend().lower();"
25+
)
26+
ret = subprocess.call([sys.executable, "-c", test_code], env=env)
27+
28+
assert ret == 0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /