mailr17822 - in /branches/inversion-recovery: ./ gui/ test_suite/ test_suite/gui_tests/ test_suite/unit_tests/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on October 16, 2012 - 09:59:
Author: bugman
Date: Tue Oct 16 09:59:24 2012
New Revision: 17822

URL: http://svn.gna.org/viewcvs/relax?rev=17822&view=rev
Log:
Merged revisions 17812-17820 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r17812 | bugman | 2012-10-15 15:27:08 +0200 (Mon, 15 Oct 2012) | 3 lines
  
  Python 3 fix for the compat module - the Queue2 object needs to always be 
defined.
........
  r17813 | bugman | 2012-10-15 16:35:44 +0200 (Mon, 15 Oct 2012) | 6 lines
  
  Bug fix for the unit test runner - this restores functionality broken all 
the way back at r12100.
  
  The TEST_SUITE_ROOT constant no longer exists, so the check for it is now 
skipped.  This allows
  tests to be run directly be the script.
........
  r17814 | bugman | 2012-10-15 16:42:07 +0200 (Mon, 15 Oct 2012) | 5 lines
  
  Python 2.3 and earlier fix for the unit test module for the float module.
  
  The 'tests' class variable was renamed so that the test suite does not 
think that it is a unit test.
........
  r17815 | bugman | 2012-10-15 17:14:26 +0200 (Mon, 15 Oct 2012) | 3 lines
  
  The GUI is now cleanly exited with a call to wx.App.ExitMainLoop rather 
than wx.Exit.
........
  r17816 | bugman | 2012-10-15 17:24:36 +0200 (Mon, 15 Oct 2012) | 3 lines
  
  Even cleaner exiting of the GUI - the interpreter thread is terminated by 
the exit_gui() method.
........
  r17817 | bugman | 2012-10-15 18:16:37 +0200 (Mon, 15 Oct 2012) | 5 lines
  
  The text relax controller log is no longer cleared when a reset occurs.
  
  This allows the test suite results to still be presented in GUI mode.
........
  r17818 | bugman | 2012-10-15 18:29:47 +0200 (Mon, 15 Oct 2012) | 10 lines
  
  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.
........
  r17819 | bugman | 2012-10-15 18:36:40 +0200 (Mon, 15 Oct 2012) | 3 lines
  
  The test suite can now run again when wxPython is missing (bug from the 
last commit).
........
  r17820 | bugman | 2012-10-16 09:56:37 +0200 (Tue, 16 Oct 2012) | 3 lines
  
  Better formatting of the test suite summary.
........

Modified:
    branches/inversion-recovery/   (props changed)
    branches/inversion-recovery/compat.py
    branches/inversion-recovery/gui/controller.py
    branches/inversion-recovery/gui/relax_gui.py
    branches/inversion-recovery/test_suite/formatting.py
    branches/inversion-recovery/test_suite/gui_tests/__init__.py
    branches/inversion-recovery/test_suite/gui_tests/base_classes.py
    branches/inversion-recovery/test_suite/test_suite_runner.py
    branches/inversion-recovery/test_suite/unit_tests/test_float.py
    branches/inversion-recovery/test_suite/unit_tests/unit_test_runner.py

Propchange: branches/inversion-recovery/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Oct 16 09:59:24 2012
@@ -1,1 +1,1 @@
-/trunk:1-17809
+/trunk:1-17821

Modified: branches/inversion-recovery/compat.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/compat.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/compat.py (original)
+++ branches/inversion-recovery/compat.py Tue Oct 16 09:59:24 2012
@@ -31,6 +31,7 @@
     from Queue import Queue as Queue2
 else:
     from queue import Queue as Queue3
+    Queue2 = Queue3
 import threading
 
 

Modified: branches/inversion-recovery/gui/controller.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/gui/controller.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/gui/controller.py (original)
+++ branches/inversion-recovery/gui/controller.py Tue Oct 16 09:59:24 2012
@@ -352,9 +352,6 @@
         # Reset the main gauge.
         wx.CallAfter(self.main_gauge.SetValue, 0)
 
-        # Clear the log.
-        wx.CallAfter(self.log_panel.clear)
-
 
     def setup_frame(self):
         """Set up the relax controller frame.

Modified: branches/inversion-recovery/gui/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/gui/relax_gui.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/gui/relax_gui.py (original)
+++ branches/inversion-recovery/gui/relax_gui.py Tue Oct 16 09:59:24 2012
@@ -451,8 +451,12 @@
             if hasattr(self, 'taskbar_icon'):
                 self.taskbar_icon.Destroy()
 
-            # End application.
-            wx.Exit()
+            # Terminate the interpreter thread to allow for a cleaner exit.
+            self.interpreter.exit()
+
+            # End the GUI main loop.
+            app = wx.GetApp()
+            app.ExitMainLoop()
 
 
     def init_data(self):

Modified: branches/inversion-recovery/test_suite/formatting.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/test_suite/formatting.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/test_suite/formatting.py (original)
+++ branches/inversion-recovery/test_suite/formatting.py Tue Oct 16 09:59:24 
2012
@@ -43,7 +43,7 @@
     sys.stdout.write("\n\n")
 
 
-def summary_line(name, passed, width=64):
+def summary_line(name, passed, width=100):
     """Print a summary line.
 
     @param name:    The name of the test, test category, etc.
@@ -54,24 +54,25 @@
     @type width:    int
     """
 
-    # Name.
-    sys.stdout.write(name + " ")
-
-    # Dots.
-    for j in range(width - len(name)):
-        sys.stdout.write(".")
-
     # Passed.
     if passed == True:
-        sys.stdout.write(" %-10s\n" % "[ OK ]")
+        state = "OK"
 
     # Skipped.
     elif passed == 'skip':
-        sys.stdout.write(" %-10s\n" % "[ Skipped ]")
+        state = "Skipped"
 
     # Failed.
     else:
-        sys.stdout.write(" %-10s\n" % "[ Failed ]")
+        state = "Failed"
+
+    # Dots.
+    dots = ''
+    for j in range(width - len(name) - len(state) - 6):
+        dots += '.'
+
+    # Write out the line.
+    sys.stdout.write("%s %s [ %s ]\n" % (name, dots, state))
 
 
 def title(text):

Modified: branches/inversion-recovery/test_suite/gui_tests/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/test_suite/gui_tests/__init__.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/test_suite/gui_tests/__init__.py (original)
+++ branches/inversion-recovery/test_suite/gui_tests/__init__.py Tue Oct 16 
09:59:24 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: branches/inversion-recovery/test_suite/gui_tests/base_classes.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/test_suite/gui_tests/base_classes.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/test_suite/gui_tests/base_classes.py 
(original)
+++ branches/inversion-recovery/test_suite/gui_tests/base_classes.py Tue Oct 
16 09:59:24 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: branches/inversion-recovery/test_suite/test_suite_runner.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/test_suite/test_suite_runner.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/test_suite/test_suite_runner.py (original)
+++ branches/inversion-recovery/test_suite/test_suite_runner.py Tue Oct 16 
09:59:24 2012
@@ -19,12 +19,14 @@
 #                                                                            
 #
 
###############################################################################
 
+# Dependency checks.
+import dep_check
+
 # Python module imports.
 import os
 import sys
-
-# Dependency checks.
-import dep_check
+if dep_check.wx_module:
+    import wx
 
 # Formatting.
 from test_suite.formatting import subtitle, summary_line, title
@@ -36,6 +38,9 @@
 from test_suite.unit_tests.unit_test_runner import Unit_test_runner
 
 # relax module imports.
+if dep_check.wx_module:
+    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 +114,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:

Modified: branches/inversion-recovery/test_suite/unit_tests/test_float.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/test_suite/unit_tests/test_float.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/test_suite/unit_tests/test_float.py (original)
+++ branches/inversion-recovery/test_suite/unit_tests/test_float.py Tue Oct 
16 09:59:24 2012
@@ -1,7 +1,7 @@
 
###############################################################################
 #                                                                            
 #
 # Copyright (C) 2006 Gary Thompson                                           
 #
-# Copyright (C) 2009 Edward d'Auvergne                                       
 #
+# Copyright (C) 2009-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -63,7 +63,7 @@
     """Unit tests for the functions of the 'float' module."""
 
     # A dictionary of all numerical types (the key is the memory address, 
i.e. this is like a pointer).
-    tests = make_dict_by_id([pos_inf, neg_inf, FLOAT_NORMAL, 
NEG_FLOAT_NORMAL, FLOAT_EPSILON, NEG_FLOAT_EPSILON, nan, ZERO, NEG_ZERO])
+    num_types = make_dict_by_id([pos_inf, neg_inf, FLOAT_NORMAL, 
NEG_FLOAT_NORMAL, FLOAT_EPSILON, NEG_FLOAT_EPSILON, nan, ZERO, NEG_ZERO])
 
     def do_test_sets(self, function, true_class=[], false_class=[]):
         """Method for checking all the values against the given function."""
@@ -104,7 +104,7 @@
         negatives = (neg_inf, NEG_FLOAT_NORMAL, NEG_FLOAT_EPSILON, NEG_ZERO)
 
         # Positive values.
-        positives = winnow_dist_to_list_by_id(self.tests, negatives)
+        positives = winnow_dist_to_list_by_id(self.num_types, negatives)
 
         # Run the tests.
         self.do_test_sets(isPositive, true_class=positives, 
false_class=negatives)
@@ -117,7 +117,7 @@
         zeros = (ZERO, NEG_ZERO)
 
         # All other numbers.
-        non_zeros = winnow_dist_to_list_by_id(self.tests, zeros)
+        non_zeros = winnow_dist_to_list_by_id(self.num_types, zeros)
 
         # Run the tests.
         self.do_test_sets(isZero, true_class=zeros, false_class=non_zeros)

Modified: 
branches/inversion-recovery/test_suite/unit_tests/unit_test_runner.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/test_suite/unit_tests/unit_test_runner.py?rev=17822&r1=17821&r2=17822&view=diff
==============================================================================
--- branches/inversion-recovery/test_suite/unit_tests/unit_test_runner.py 
(original)
+++ branches/inversion-recovery/test_suite/unit_tests/unit_test_runner.py Tue 
Oct 16 09:59:24 2012
@@ -459,8 +459,6 @@
             test_module = self.root_path
         elif test_module == os.curdir:
             test_module =  os.getcwd()
-        elif test_module == self.TEST_SUITE_ROOT:
-            test_module = self.unit_test_directory
 
         self.test_module = test_module
 




Related Messages


Powered by MHonArc, Updated Tue Oct 16 10:00:02 2012