Author: bugman Date: Wed Jun 29 19:53:01 2011 New Revision: 13321 URL: http://svn.gna.org/viewcvs/relax?rev=13321&view=rev Log: The GUI tests are now checking if exceptions have occurred in the threads. Modified: branches/gui_testing/test_suite/gui_tests/noe.py branches/gui_testing/test_suite/gui_tests/rx.py Modified: branches/gui_testing/test_suite/gui_tests/noe.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/test_suite/gui_tests/noe.py?rev=13321&r1=13320&r2=13321&view=diff ============================================================================== --- branches/gui_testing/test_suite/gui_tests/noe.py (original) +++ branches/gui_testing/test_suite/gui_tests/noe.py Wed Jun 29 19:53:01 2011 @@ -22,9 +22,11 @@ # Python module imports. from os import F_OK, access, sep +import Queue from shutil import rmtree from tempfile import mkdtemp from time import sleep +from traceback import print_exception from unittest import TestCase import wx @@ -72,6 +74,27 @@ self.gui.Destroy() + def check_exceptions(self): + """Check that no exception has occurred.""" + + # Check. + try: + # Get the exception from the queue. + index, exc = status.analyses.exception_queue.get(block=False) + + # Print it. + print("Exception raised in thread.\n") + print_exception(exc[0], exc[1], exc[2]) + print("\n\n") + + # Fail. + self.fail() + + # No exception. + except Queue.Empty: + pass + + def test_noe_analysis(self): """Test the NOE analysis.""" @@ -115,6 +138,9 @@ # Wait for execution to complete. page.thread.join() + # Exceptions in the thread. + self.check_exceptions() + # The real data. res_nums = [4, 5, 6] sat = [5050.0, 51643.0, 53663.0] Modified: branches/gui_testing/test_suite/gui_tests/rx.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/test_suite/gui_tests/rx.py?rev=13321&r1=13320&r2=13321&view=diff ============================================================================== --- branches/gui_testing/test_suite/gui_tests/rx.py (original) +++ branches/gui_testing/test_suite/gui_tests/rx.py Wed Jun 29 19:53:01 2011 @@ -22,9 +22,11 @@ # Python module imports. from os import F_OK, access, sep +import Queue from shutil import rmtree from tempfile import mkdtemp from time import sleep +from traceback import print_exception from unittest import TestCase import wx @@ -70,6 +72,27 @@ # Destroy the GUI. self.gui.Destroy() + + + def check_exceptions(self): + """Check that no exception has occurred.""" + + # Check. + try: + # Get the exception from the queue. + index, exc = status.analyses.exception_queue.get(block=False) + + # Print it. + print("Exception raised in thread.\n") + print_exception(exc[0], exc[1], exc[2]) + print("\n\n") + + # Fail. + self.fail() + + # No exception. + except Queue.Empty: + pass def test_r1_analysis(self): @@ -145,6 +168,9 @@ # Wait for execution to complete. page.thread.join() + # Exceptions in the thread. + self.check_exceptions() + # The real data. res_nums = [4, 5, 6] sat = [5050.0, 51643.0, 53663.0]