Author: bugman
Date: Tue Feb 3 17:58:51 2015
New Revision: 27491
URL: http://svn.gna.org/viewcvs/relax?rev=27491&view=rev
Log:
Added memory management checking to the GUI test suite tearDown() method.
If any top level windows are present, excluding the main GUI window and the
relax controller, then a
RelaxError will be raised. Such a check will significantly help in future GUI
coding, as now there
will be feedback if not all windows are properly destroyed.
Modified:
trunk/test_suite/gui_tests/base_classes.py
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=27491&r1=27490&r2=27491&view=diff
==============================================================================
--- trunk/test_suite/gui_tests/base_classes.py (original)
+++ trunk/test_suite/gui_tests/base_classes.py Tue Feb 3 17:58:51 2015
@@ -31,6 +31,8 @@
# relax module imports.
from data_store import Relax_data_store; ds = Relax_data_store()
+from gui.controller import Controller
+from gui.relax_gui import Main
from gui.string_conv import str_to_gui
from gui.uf_objects import Uf_storage; uf_store = Uf_storage()
from gui.wizards.wiz_objects import Wiz_window
@@ -307,9 +309,22 @@
# Print out a list of all living windows to help ensure that custom
Close() and Destroy() methods are cleaning up all objects.
print("\n\nList of all living GUI elements - this must only include
the main GUI window and the relax controller:")
+ all_destroyed = True
for window in wx.GetTopLevelWindows():
+ # Printout.
print(" Window: %s" % window)
if isinstance(window, Wiz_window):
print(" Wizard title: %s" % window.title)
print(" Wizard pages: %s" % window._pages)
+
+ # Skip the main GUI window and the relax controller.
+ if isinstance(window, Main) or isinstance(window, Controller):
+ continue
+
+ # Failure of memory management.
+ all_destroyed = False
print("\n\n\n")
+
+ # Memory management check.
+ if not all_destroyed:
+ raise RelaxError("Memory management failure - not all top level
windows have been destroyed.")
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits