Browse Source

[desktop] Fix dump_traceback test

In python2.6, the threading.Event.wait method always returns None.
This was changed in 2.7 to return a boolean if the wait timed out.
Erick Tryzelaar 10 years ago
parent
commit
bbd91fbe76
1 changed files with 6 additions and 4 deletions
  1. 6 4
      desktop/core/src/desktop/lib/thread_util_test.py

+ 6 - 4
desktop/core/src/desktop/lib/thread_util_test.py

@@ -24,12 +24,13 @@ from desktop.lib.thread_util import dump_traceback
 
 
 def test_dump_traceback():
 def test_dump_traceback():
   started = threading.Event()
   started = threading.Event()
-  stop = threading.Event()
+  stopped = threading.Event()
 
 
   class Thread(threading.Thread):
   class Thread(threading.Thread):
     def run(self):
     def run(self):
       started.set()
       started.set()
-      assert_true(stop.wait(10.0))
+      stopped.wait(10.0)
+      assert_true(stopped.is_set())
 
 
   thread = Thread(name='thread_util_test thread')
   thread = Thread(name='thread_util_test thread')
   thread.start()
   thread.start()
@@ -38,7 +39,8 @@ def test_dump_traceback():
   header = 'Thread thread_util_test thread %s' % thread_ident
   header = 'Thread thread_util_test thread %s' % thread_ident
 
 
   try:
   try:
-    assert_true(started.wait(10.0))
+    started.wait(10.0)
+    assert_true(started.is_set())
 
 
     out = StringIO.StringIO()
     out = StringIO.StringIO()
     dump_traceback(file=out)
     dump_traceback(file=out)
@@ -50,5 +52,5 @@ def test_dump_traceback():
 
 
     assert_true(header not in out.getvalue())
     assert_true(header not in out.getvalue())
   finally:
   finally:
-    stop.set()
+    stopped.set()
     thread.join()
     thread.join()