Skip to content

Commit

Permalink
Improve tests using wx
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Nov 22, 2024
1 parent d8ac63a commit faf351b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 28 deletions.
2 changes: 2 additions & 0 deletions utest/editor/test_texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def tearDown(self):
# wx.CallAfter(wx.Exit)
self.shared_mem.shm.close()
self.shared_mem.shm.unlink()
self.app.ExitMainLoop()
self.app.Destroy()
self.app = None

Expand Down Expand Up @@ -659,6 +660,7 @@ def tearDown(self):
# wx.CallAfter(wx.Exit)
self.shared_mem.shm.close()
self.shared_mem.shm.unlink()
self.app.ExitMainLoop()
self.app.Destroy()
self.app = None

Expand Down
4 changes: 4 additions & 0 deletions utest/logs/test_log_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def my_show(*args):
self._panel.SetSize(200, 400)
self._panel.close(note)

myapp.ExitMainLoop()
myapp.Destroy()
myapp = None

def test_message_log(self):
result = message_to_string(log[0])
assert result.strip() == '20230604 20:40:41.415 [INFO]: Found Robot Framework version 6.0.2 from path'
Expand Down
21 changes: 0 additions & 21 deletions utest/resources/fake.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion utest/run/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_command_as_string(self):
assert len(processed_command) == len(initial_command.split())
assert processed_command[4] == 'a2 2 1'

@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS'), reason="Fails at Fedora workflow")
@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS')=='true', reason="Fails at Fedora workflow")
def test_writing_to_stderr(self):
self.proc = self._create_process('python %s stderr' % SCRIPT)
eol = '\r\n' if IS_WINDOWS else '\n'
Expand Down
6 changes: 3 additions & 3 deletions utest/run/test_run_anything.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def update_output(self, output, finished):

class TestRunAnything(UIUnitTestBase):

@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS'), reason="Fails at Fedora workflow")
@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS')=='true', reason="Fails at Fedora workflow")
def test_run(self):
self.runner = self._create_runner('python %s count_args a b c' % SCRIPT)
self._wait_until_finished()
assert self.runner.finished
assert self.runner.outstr == '3\n'

@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS'), reason="Fails at Fedora workflow")
@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS')=='true', reason="Fails at Fedora workflow")
def test_stopping(self):
self.runner = self._create_runner('python %s output 0.8' % SCRIPT)
time.sleep(0.3)
Expand All @@ -77,7 +77,7 @@ def test_error(self):
assert self.runner.finished
assert self.runner.outstr

@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS'), reason="Fails at Fedora workflow")
@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS')=='true', reason="Fails at Fedora workflow")
def test_stderr(self):
self.runner = self._create_runner('python %s stderr' % SCRIPT)
self._wait_until_finished()
Expand Down
1 change: 1 addition & 0 deletions utest/run/test_ui_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def setUp(self):
def tearDown(self):
PUBLISHER.unsubscribe_all()
# wx.CallAfter(self.app.ExitMainLoop)
self.app.ExitMainLoop()
self.app.Destroy()
self.app = None

Expand Down
2 changes: 1 addition & 1 deletion utest/ui/test_contextdialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def setUp(self):

def tearDown(self):
PUBLISHER.unsubscribe_all()
wx.CallAfter(self.app.ExitMainLoop)
self.app.ExitMainLoop()
self.app.Destroy()
self.app = None
# app.MainLoop() # With this here, there is no Segmentation fault
Expand Down
6 changes: 4 additions & 2 deletions utest/ui/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ def setUp(self):

def tearDown(self):
PUBLISHER.unsubscribe_all()
wx.CallAfter(self.frame.Close)
wx.CallAfter(self.app.ExitMainLoop)
# wx.CallAfter(self.frame.Close)
# wx.CallAfter(self.app.ExitMainLoop)
self.app.ExitMainLoop()
self.app.Destroy()
# self.app.MainLoop() # With this here, there is no Segmentation fault
self.app = None

Expand Down

0 comments on commit faf351b

Please sign in to comment.