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

Skip to content

Commit 903d118

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 22aa800 commit 903d118

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
@@ -228,7 +228,7 @@ def test(self):
228228
@knownfailureif(
229229
will_fail, fail_msg,
230230
known_exception_class=ImageComparisonFailure)
231-
def do_test():
231+
def do_test(fignum, actual_fname, expected_fname):
232232
figure = plt.figure(fignum)
233233

234234
if self._remove_text:
@@ -255,7 +255,7 @@ def do_test():
255255
(self._freetype_version, ft2font.__freetype_version__))
256256
raise
257257

258-
yield (do_test,)
258+
yield do_test, fignum, actual_fname, expected_fname
259259

260260

261261
def image_comparison(baseline_images=None, extensions=None, tol=0,

0 c 31B7 ommit comments

Comments
 (0)
0