Skip to content

Commit 019a752

Browse files
authored
add test with -OO (#17988)
1 parent 21c3e3f commit 019a752

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_matplotlib.py

+15
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,18 @@ def parse(key):
4242
set(matplotlib.rcsetup.interactive_bk))
4343
assert (set(parse('- non-interactive backends:\n')) ==
4444
set(matplotlib.rcsetup.non_interactive_bk))
45+
46+
47+
def test_importable_with__OO():
48+
"""
49+
When using -OO or export PYTHONOPTIMIZE=2, docstrings are discarded,
50+
this simple test may prevent something like issue #17970.
51+
"""
52+
program = (
53+
"import matplotlib as mpl; "
54+
"import matplotlib.pyplot as plt; "
55+
"import matplotlib.cbook as cbook; "
56+
"import matplotlib.patches as mpatches"
57+
)
58+
cmd = [sys.executable, "-OO", "-c", program]
59+
assert subprocess.call(cmd) == 0

0 commit comments

Comments
 (0)