From: James Procter Date: Wed, 20 Sep 2023 14:14:05 +0000 (+0100) Subject: JAL-4217 - try to invokeAndWait on Desktop.closeAll() to avoid Jmol redraw blocking... X-Git-Tag: Release_2_11_4_0~179^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5ed233c0db216f471a96067281914621f40b342c;p=jalview.git JAL-4217 - try to invokeAndWait on Desktop.closeAll() to avoid Jmol redraw blocking close --- diff --git a/test/jalview/bin/CommandsTest.java b/test/jalview/bin/CommandsTest.java index 4d10c31..8dae8f3 100644 --- a/test/jalview/bin/CommandsTest.java +++ b/test/jalview/bin/CommandsTest.java @@ -2,11 +2,14 @@ package jalview.bin; import java.io.File; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; import java.util.Date; import java.util.HashSet; import java.util.Set; +import javax.swing.SwingUtilities; + import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; @@ -46,9 +49,26 @@ public class CommandsTest } @AfterMethod(alwaysRun = true) - public void tearDown() + public void tearDown() { - Desktop.closeDesktop(); + try + { + // occasionally we are blocked by Jmol redraws + SwingUtilities.invokeAndWait(new Runnable() + { + + @Override + public void run() + { + Desktop.closeDesktop(); + } + }); + } catch (Exception foo) + { + System.err.println("Failed during teardown with exception"); + foo.printStackTrace(); + } + } public static void callJalviewMain(String[] args)