[[nbpython-commits]] [hg] main/contrib: Work around potential test runner results win...

  • From: Tor Norbye < >
  • To:
  • Subject: [[nbpython-commits]] [hg] main/contrib: Work around potential test runner results win...
  • Date: Thu, 21 Oct 2010 08:34:27 -0700

changeset 3d0518ea73b4 in main/contrib
details: http://hg.netbeans.org/main/contrib?cmd=changeset;node=3d0518ea73b4
description:
        Work around potential test runner results window deadlock

diffstat:

 
python.testrunner/src/org/netbeans/modules/python/testrunner/PyUnitRunner.java
 |  22 ++++++++-
 1 files changed, 19 insertions(+), 3 deletions(-)

diffs (41 lines):

diff --git 
a/python.testrunner/src/org/netbeans/modules/python/testrunner/PyUnitRunner.java
 
b/python.testrunner/src/org/netbeans/modules/python/testrunner/PyUnitRunner.java
--- 
a/python.testrunner/src/org/netbeans/modules/python/testrunner/PyUnitRunner.java
+++ 
b/python.testrunner/src/org/netbeans/modules/python/testrunner/PyUnitRunner.java
@@ -43,7 +43,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
-import org.netbeans.api.extexecution.print.LineConvertors.FileLocator;
+import javax.swing.SwingUtilities;
 import org.netbeans.api.project.FileOwnerQuery;
 import org.netbeans.api.project.Project;
 import org.netbeans.api.project.ProjectUtils;
@@ -278,10 +278,26 @@
             }
 
 
-        TestSession session = new TestSession(name, 
+        final TestSession session = new TestSession(name,
                 project,
                 debug ? SessionType.DEBUG : SessionType.TEST, new 
PythonTestRunnerNodeFactory());
-        TestExecutionManager.getInstance().start(desc, new 
PyUnitHandlerFactory(), session);
+        // Deadlock avoidance; remove later. Currently, if you try to run a 
unit test
+        // on a new user directory (when the Test Results window hasn't yet 
been shown)
+        // you could run into a deadlock. This avoids that.
+        boolean redispatch = true;
+        if (SwingUtilities.isEventDispatchThread()) {
+            redispatch = false;
+        }
+        if (redispatch) {
+            final PythonExecution descriptor = desc;
+            SwingUtilities.invokeLater(new Runnable() {
+                public void run() {
+                    TestExecutionManager.getInstance().start(descriptor, new 
PyUnitHandlerFactory(), session);
+                }
+            });
+        } else {
+            TestExecutionManager.getInstance().start(desc, new 
PyUnitHandlerFactory(), session);
+        }
     }
 
     public boolean supports(TestType type) {

[[nbpython-commits]] [hg] main/contrib: Work around potential test runner results win...

Tor Norbye 10/21/2010

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close