mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-15 17:20:07 +01:00
Merge pull request #1845 from wxWidgets/fix-issue1842
Add context manager methods to wx.LogNull
This commit is contained in:
@@ -79,6 +79,8 @@ New and improved in this release:
|
||||
was done to workaround a bug in wxMac, but it seems worthwhile enough to keep
|
||||
it around even after the bug was fixed.
|
||||
|
||||
* Added the missing context manager methods for wx.LogNull. (#1842)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user