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

Skip to content

Commit 5bd9a60

Browse files
committed
TST: Fix image comparison directory for test_striped_lines
The image comparison directory is determined by `inspect.getfile(func)`, but when a test is wrapped in `rc_context`, the file returned is `contextlib` since that decorator is `contextlib.contextmanager`. Since this test uses `check_figures_equal`, that doesn't break it, but it does break the `triage_tests.py` tool as it cannot find a corresponding baseline image directory. Moving the `rc_context` decorator above `check_figures_equal` fixes the determined directory. While in this case, the context doesn't set anything that would affect figures, it also makes sense to set the context before figures are created.
1 parent 1e8ea2f commit 5bd9a60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/tests/test_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,9 +1309,9 @@ def test_check_offsets_dtype():
13091309
assert isinstance(scat.get_offsets(), type(unmasked_offsets))
13101310

13111311

1312+
@mpl.rc_context({'lines.linewidth': 20})
13121313
@pytest.mark.parametrize('gapcolor', ['orange', ['r', 'k']])
13131314
@check_figures_equal(extensions=['png'])
1314-
@mpl.rc_context({'lines.linewidth': 20})
13151315
def test_striped_lines(fig_test, fig_ref, gapcolor):
13161316
ax_test = fig_test.add_subplot(111)
13171317
ax_ref = fig_ref.add_subplot(111)

0 commit comments

Comments
 (0)