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

Skip to content

Commit b672f68

Browse files
committed
Fix running test_internal_cpp_api directly.
The `matplotlib._tri` module is lazily loaded, so using it directly (as done in this test) may fail if something else doesn't load it. This test would fail if it was the first tri-related test run in a process (if testing in parallel), or if just called as the only test, i.e., this commit fixes: ``` $ pytest -k test_internal_cpp_api lib/matplotlib/tests/test_triangulation.py __________ test_internal_cpp_api __________ def test_internal_cpp_api(): # Following github issue 8197. # C++ Triangulation. with pytest.raises( TypeError, match=r'function takes exactly 7 arguments \(0 given\)'): > mpl._tri.Triangulation() E AttributeError: module 'matplotlib' has no attribute '_tri' lib/matplotlib/tests/test_triangulation.py:1039: AttributeError ```
1 parent 9c89f7a commit b672f68

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lib/matplotlib/tests/test_triangulation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ def test_tricontourf_decreasing_levels():
10311031

10321032
def test_internal_cpp_api():
10331033
# Following github issue 8197.
1034+
from matplotlib import _tri # noqa: ensure lazy-loaded module *is* loaded.
10341035

10351036
# C++ Triangulation.
10361037
with pytest.raises(

0 commit comments

Comments
 (0)