Tests: fix wx_widgets.pytest/test_CustomIntCtrl.py
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Wed, 15 May 2024 18:50:26 +0200
changeset 3944 ebd25bbe5a73
parent 3943 5df2cbc1cd1a
child 3945 d303aab8f68b
Tests: fix wx_widgets.pytest/test_CustomIntCtrl.py
tests/ide_tests/wx_widgets.pytest/test_CustomIntCtrl.py
--- a/tests/ide_tests/wx_widgets.pytest/test_CustomIntCtrl.py	Wed May 15 08:59:38 2024 +0200
+++ b/tests/ide_tests/wx_widgets.pytest/test_CustomIntCtrl.py	Wed May 15 18:50:26 2024 +0200
@@ -33,15 +33,22 @@
 import controls.CustomIntCtrl
 
 
+wxApp = None
+
 class TestCustomIntCtrl(unittest.TestCase):
     def setUp(self):
-        self.app = wx.App()
+        global wxApp
+        if wxApp is None:
+            wxApp = wx.App()
         self.frame = wx.Frame(None)
 
     def tearDown(self):
+        global wxApp
         self.frame.Destroy()
-        wx.CallAfter(wx.Exit)
-        self.app.MainLoop()
+        if wxApp is not None:
+            wx.CallAfter(wx.Exit)
+            wxApp.MainLoop()
+            wxApp = None
 
     def testMaxLimit(self):
         """Test working upper bound"""