Skip to content

Commit 454a08c

Browse files
Improve utests (#2944)
* Improve application utest * Collect coverage-reports
1 parent f726ce4 commit 454a08c

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.github/workflows/fedora_41.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
- uses: actions/upload-artifact@v4
9494
with:
9595
name: coverage-report
96-
path: .coverage-reports
96+
path: .coverage-reports/**
9797
- name: Install and run
9898
run: |
9999
git submodule update --init --recursive

.github/workflows/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
- uses: actions/upload-artifact@v4
129129
with:
130130
name: coverage-report
131-
path: .coverage-reports
131+
path: .coverage-reports/**
132132
- name: Install and run
133133
run: |
134134
git submodule update --init --recursive

utest/application/test_app_main.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def my_show(*args):
220220
m.setattr(MessageDialog, 'ShowModal', my_show)
221221
robotide._show_old_wxpython_warning_if_needed()
222222

223+
@pytest.mark.skipif(sys.platform != 'win32', reason="Test only for Windows")
223224
def test_replace_std_for_win(self):
224225
import robotide
225226
import sys
@@ -229,6 +230,10 @@ def test_replace_std_for_win(self):
229230
m.setattr(sys, 'stderr', None)
230231
m.setattr(sys, 'stdout', None)
231232
robotide._replace_std_for_win()
233+
sys.stdout.write('content')
234+
sys.stdout.writelines(['content', 'line two'])
235+
sys.stdout.flush()
236+
sys.stdout.close()
232237

233238

234239
class TestMisc(unittest.TestCase):
@@ -240,7 +245,6 @@ def setUp(self):
240245
self.frame = self.main_app.frame
241246
self.main_app.SetExitOnFrameDelete(True)
242247

243-
244248
def tearDown(self):
245249
builtins.__import__ = real_import
246250
self.main_app.Destroy()
@@ -250,6 +254,16 @@ def test_get_code(self):
250254
code = self.main_app._get_language_code()
251255
assert code in (175, wx.LANGUAGE_ENGLISH_WORLD, wx.LANGUAGE_PORTUGUESE)
252256

257+
@pytest.mark.skipif(sys.platform != 'win32', reason="Test only for Windows")
258+
def test_nullstream(self):
259+
import sys
260+
from robotide import _replace_std_for_win
261+
_replace_std_for_win()
262+
sys.stdout.write('content')
263+
sys.stdout.writelines(['content', 'line two'])
264+
sys.stdout.flush()
265+
sys.stdout.close()
266+
253267

254268
if __name__ == '__main__':
255269
unittest.main()

0 commit comments

Comments
 (0)