diff --git a/unittests/test_lib_mixins_inspection.py b/unittests/test_lib_mixins_inspection.py index fea951e5..39f62ba5 100644 --- a/unittests/test_lib_mixins_inspection.py +++ b/unittests/test_lib_mixins_inspection.py @@ -1,4 +1,5 @@ import unittest +import time import wx import wx.lib.mixins.inspection as wit @@ -6,6 +7,26 @@ import wx.lib.mixins.inspection as wit class wit_TestCase(unittest.TestCase): + def tearDown(self): + ''' + OnClose can trigger: + AttributeError: 'Crust' object has no attribute 'lastsashpos' + so we'll ensure that the InspectionFrame's crust has that attr. + ''' + windows = wx.GetTopLevelWindows() + for window in windows: + if type(window) == wx.lib.inspection.InspectionFrame: + if hasattr(window, 'crust'): + pass + if not hasattr(window.crust, 'lastsashpos'): + window.crust.lastsashpos = -1 + + # class _InspectionHighlighter's FlickerTLW method invokes + # wx.CallLater(300, self._Toggle, tlw), + # so let's give it a chance to run: + time.sleep(0.3) + super(wit_TestCase, self).tearDown() + def test_App(self): app = wit.InspectableApp()