Skip to content

Video editing with Python

Fix test 'test_matplotlib' in 'test_examples.py' (#1427)

Álvaro Mondéjar381be8c15545
diff --git a/tests/test_examples.py b/tests/test_examples.py
index 76550202..140aa5a6 100644
--- a/tests/test_examples.py
+++ b/tests/test_examples.py
@@ -15,18 +15,16 @@ except ImportError:
matplotlib = None
[email protected](True, reason="testing on github actions")
@pytest.mark.skipif(not matplotlib, reason="no mpl")
-def test_matplotlib():
- # for now, python 3.5 installs a version of matplotlib that complains
- # about $DISPLAY variable, so lets just ignore for now.
+def test_matplotlib_simple_example():
+ import matplotlib.pyplot as plt
- x = np.linspace(-2, 2, 200)
+ plt.switch_backend("agg")
+ x = np.linspace(-2, 2, 200)
duration = 2
- matplotlib.use("Agg")
- fig, ax = matplotlib.pyplot.subplots()
+ fig, ax = plt.subplots()
def make_frame(t):
ax.clear()