Add missing context manager methods for wx.LogNull

This commit is contained in:
Robin Dunn
2020-11-10 14:43:18 -08:00
parent 4402d87599
commit c4f1e9f3bd
2 changed files with 10 additions and 2 deletions

View File

@@ -116,11 +116,13 @@ def run():
c.addPrivateCopyCtor()
c.addPrivateAssignOp()
c = module.find('wxLogFormatter')
c.find('FormatTime').ignore(False)
c = module.find('wxLogNull')
c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False')
#-----------------------------------------------------------------
tools.doCommonTweaks(module)

View File

@@ -23,6 +23,12 @@ class log_Tests(wtc.WidgetTestCase):
wx.LogMessage("This is a test")
self.assertTrue(log.messageLogged)
def test_lognull_is_context_mgr(self):
with wx.LogNull():
pass
#---------------------------------------------------------------------------