Author: bugman Date: Mon Oct 15 18:29:47 2012 New Revision: 17818 URL: http://svn.gna.org/viewcvs/relax?rev=17818&view=rev Log: Big fixes for the running of the GUI tests. The GUI initialisation and termination, when not running in GUI mode, is now preformed outside of the Python unittest framework. The GUI was previously initalised in the setUp() method for all GUI tests, but for some reason this caused abrupt terminations of the GUI_test_runner.run() method. This run method, when finished, would not return to the Test_suite_runner but would cause the Python interpreter to silently die. The result was that the test suite summary would appear not to be printed out. Modified: trunk/test_suite/gui_tests/__init__.py trunk/test_suite/gui_tests/base_classes.py trunk/test_suite/test_suite_runner.py Modified: trunk/test_suite/gui_tests/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/__init__.py?rev=17818&r1=17817&r2=17818&view=diff ============================================================================== --- trunk/test_suite/gui_tests/__init__.py (original) +++ trunk/test_suite/gui_tests/__init__.py Mon Oct 15 18:29:47 2012 @@ -25,9 +25,9 @@ # Python module imports. from re import search from unittest import TestSuite +import wx # relax module imports. -from gui.interpreter import Interpreter from relax_errors import RelaxError # relax GUI test module imports. @@ -133,9 +133,5 @@ # Run the test suite. results = runner.run(full_suite) - # Terminate the interpreter thread to allow the tests to cleanly exit. - interpreter = Interpreter() - interpreter.exit() - # Return the status of the tests. return results.wasSuccessful() Modified: trunk/test_suite/gui_tests/base_classes.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/base_classes.py?rev=17818&r1=17817&r2=17818&view=diff ============================================================================== --- trunk/test_suite/gui_tests/base_classes.py (original) +++ trunk/test_suite/gui_tests/base_classes.py Mon Oct 15 18:29:47 2012 @@ -185,20 +185,8 @@ # Create a temporary directory for the results. ds.tmpdir = mkdtemp() - # Get the wx app, if it exists. + # Get the wx app. self.app = wx.GetApp() - - # Create the app if needed. - if self.app == None: - # Initialise. - self.app = wx.App(redirect=False) - - # relax GUI imports (here to prevent a circular import from the test suite in the GUI). - if dep_check.wx_module: - from gui.relax_gui import Main - - # Build the GUI. - self.app.gui = Main(parent=None, id=-1, title="") def tearDown(self): Modified: trunk/test_suite/test_suite_runner.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/test_suite_runner.py?rev=17818&r1=17817&r2=17818&view=diff ============================================================================== --- trunk/test_suite/test_suite_runner.py (original) +++ trunk/test_suite/test_suite_runner.py Mon Oct 15 18:29:47 2012 @@ -22,6 +22,7 @@ # Python module imports. import os import sys +import wx # Dependency checks. import dep_check @@ -36,6 +37,8 @@ from test_suite.unit_tests.unit_test_runner import Unit_test_runner # relax module imports. +from gui.interpreter import Interpreter +from gui.relax_gui import Main from test_suite.relax_test_runner import GuiTestRunner, RelaxTestRunner from status import Status; status = Status() @@ -109,8 +112,27 @@ # Run the tests. if dep_check.wx_module: + # Set up the GUI if needed (i.e. not in GUI mode already). + app = wx.GetApp() + if app == None: + # Initialise. + app = wx.App(redirect=False) + + # Build the GUI. + app.gui = Main(parent=None, id=-1, title="") + + # Execute the GUI tests. gui_runner = GUI_test_runner() self.gui_result = gui_runner.run(self.tests, runner=self.runner) + + # Clean up for the GUI, if not in GUI mode. + if status.test_mode: + # Terminate the interpreter thread to allow the tests to cleanly exit. + interpreter = Interpreter() + interpreter.exit() + + # Stop the GUI main loop. + app.ExitMainLoop() # No wx module installed. else: