From 8ade7983bfc66d6498a2a4c07f197b38d0fd5e4a Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 2 Oct 2022 17:50:26 -0400 Subject: [PATCH] TST: force test with shared test image to run in serial The tests test_hexbin_empty and test_hexbin_log_empty use the same target image, however if they the tests ended up being run in different workers when running the tests in parallel they will step on each other if one of the test starts writing the output file while the other is trying to read the test image. By putting them in the same test they will save and evaluate in order. --- lib/matplotlib/tests/test_axes.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 63fd6a2db297..02fcf233e542 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -894,18 +894,14 @@ def test_hexbin_extent(): ax.hexbin("x", "y", extent=[.1, .3, .6, .7], data=data) -@image_comparison(['hexbin_empty.png'], remove_text=True) +@image_comparison(['hexbin_empty.png', 'hexbin_empty.png'], remove_text=True) def test_hexbin_empty(): # From #3886: creating hexbin from empty dataset raises ValueError - ax = plt.gca() + fig, ax = plt.subplots() ax.hexbin([], []) - - -@image_comparison(['hexbin_empty.png'], remove_text=True) -def test_hexbin_log_empty(): + fig, ax = plt.subplots() # From #23922: creating hexbin with log scaling from empty # dataset raises ValueError - ax = plt.gca() ax.hexbin([], [], bins='log')