Skip to content

Commit b650c67

Browse files
committed
Don't assume cwd in test_ipynb.
The Matplotlib test suite can be run from outside of the root git directory, e.g. with pytest --pyargs matplotlib.tests.test_backend_nbagg (mplcairo explicitly relies on that to reuse the Matplotlib test suite). To ensure this, find the example notebook relative to the path of the test module, rather than relative to the current working directory.
1 parent 4b1f956 commit b650c67

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/matplotlib/tests/test_backend_nbagg.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
2-
import os
1+
from pathlib import Path
32
import subprocess
43
import tempfile
4+
55
import pytest
66

77
nbformat = pytest.importorskip('nbformat')
@@ -29,5 +29,6 @@ def _notebook_run(nb_file):
2929

3030

3131
def test_ipynb():
32-
nb, errors = _notebook_run('lib/matplotlib/tests/test_nbagg_01.ipynb')
32+
nb, errors = _notebook_run(
33+
str(Path(__file__).parent / 'test_nbagg_01.ipynb'))
3334
assert errors == []

0 commit comments

Comments
 (0)