8000 Do not rely on outer scope variables in `ImageComparisonTest.test.do_… · matplotlib/matplotlib@2c39fbd · GitHub
[go: up one dir, main page]

Skip to content

Commit 2c39fbd

Browse files
committed
Do not rely on outer scope variables in ImageComparisonTest.test.do_test
`do_test` function variables are changed by loop where function was creates. It will work as you expect only if you call yielded function immediately.
1 parent dd5ef04 commit 2c39fbd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test(self):
245245
@knownfailureif(
246246
will_fail, fail_msg,
247247
known_exception_class=ImageComparisonFailure)
248-
def do_test():
248+
def do_test(fignum, actual_fname, expected_fname):
249249
figure = plt.figure(fignum)
250250

251251
if self._remove_text:
@@ -272,7 +272,7 @@ def do_test():
272272
(self._freetype_version, ft2font.__freetype_version__))
273273
raise
274274

275-
yield (do_test,)
275+
yield (do_test, fignum, actual_fname, expected_fname)
276276

277277
def image_comparison(baseline_images=None, extensions=None, tol=0,
278278
freetype_version=None, remove_text=False,

0 commit comments

Comments
 (0)
0