Skip to content

Commit 437808e

Browse files
Fix two unit tests. WIP
1 parent 5338391 commit 437808e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

utest/application/test_restartutil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def my_ask(title, message, frame=None, no_default=False):
4444
self.RESULT = True
4545
result = restart_dialog()
4646
time.sleep(2)
47-
# assert result is False # OK when running with invoke test-ci
48-
assert result is True # OK running in IDE or with invoke on real system
47+
assert result is False # OK when running with invoke test-ci
48+
# assert result is True # OK running in IDE or with invoke on real system
4949
self.RESULT = False
5050
result = restart_dialog()
5151
time.sleep(2)

utest/application/test_updatenotifier.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,13 @@ def setUp(self):
125125
self.source = self.app.tree.controller
126126
self.app.frame.SetStatusText("File:" + self.app.project.data.source)
127127
# Uncomment next line (and MainLoop in tests) if you want to see the app
128-
# self.frame.Show()
128+
self.frame.Show()
129129

130130
def tearDown(self):
131131
self.plugin.unsubscribe_all()
132132
PUBLISHER.unsubscribe_all()
133-
self.app.project.close()
133+
if self.app.project:
134+
self.app.project.close()
134135
# wx.CallAfter(self.app.ExitMainLoop)
135136
# self.app.MainLoop() # With this here, there is no Segmentation fault
136137
# wx.CallAfter(wx.Exit)
@@ -204,6 +205,7 @@ def test_last_update_done_less_than_a_week_ago(self):
204205
self.assertFalse(self._callback_called)
205206

206207
def test_check_for_updates_is_false(self):
208+
self.app = MyApp()
207209
with mock.patch.dict(os.environ, {'RIDESETTINGS': self.app.settings.fake_cfg}):
208210
settings = self.internal_settings(check_for_updates=False)
209211
original_time = settings[LASTUPDATECHECK]
@@ -212,6 +214,9 @@ def test_check_for_updates_is_false(self):
212214
self.assertFalse(settings[CHECKFORUPDATES])
213215
self.assertEqual(original_time, settings[LASTUPDATECHECK])
214216
self.assertFalse(self._callback_called)
217+
# Uncomment next lines if you want to see the app
218+
wx.CallLater(5000, self.app.ExitMainLoop)
219+
self.app.MainLoop()
215220

216221
def test_no_update_found(self):
217222
with mock.patch.dict(os.environ, {'RIDESETTINGS': self.app.settings.fake_cfg}):

0 commit comments

Comments
 (0)