Merge lp:~om26er/ubuntu-weather-app/fix_db_tests into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Omer Akram
Status: Rejected
Rejected by: Nicholas Skaggs
Proposed branch: lp:~om26er/ubuntu-weather-app/fix_db_tests
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 55 lines (+23/-4)
2 files modified
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+22/-0)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+1/-4)
To merge this branch: bzr merge lp:~om26er/ubuntu-weather-app/fix_db_tests
Reviewer Review Type Date Requested Status
Sergio Schvezov (community) Abstain
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Review via email: mp+199278@code.launchpad.net

Commit message

make sure there is a local database before running the MainWindow tests

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Tests all pass here.

Ran 15 tests in 405.218s
OK

review: Approve
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Instead of waiting for
10 + self.main_window.visible.wait_for(True)

why not wait for the database file you care about to be created? If the app is responsible, the app being visible does not guarantee it has created the db

review: Needs Fixing
169. By Omer Akram

don't wait for the app window to appear, rather wait for the database to be created

170. By Omer Akram

import md5

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sergio Schvezov (sergiusens) :
review: Approve
Revision history for this message
Sergio Schvezov (sergiusens) :
review: Abstain
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I believe this is no longer relevant.

Unmerged revisions

170. By Omer Akram

import md5

169. By Omer Akram

don't wait for the app window to appear, rather wait for the database to be created

168. By Omer Akram

make sure we have a db before running tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-12-13 15:30:46 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-12-17 14:44:53 +0000
@@ -14,6 +14,7 @@
14import sqlite314import sqlite3
15import time15import time
16import logging16import logging
17import md5
1718
18from autopilot.input import Mouse, Touch, Pointer19from autopilot.input import Mouse, Touch, Pointer
19from autopilot.platform import model20from autopilot.platform import model
@@ -83,6 +84,27 @@
83 "com.ubuntu.weather",84 "com.ubuntu.weather",
84 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)85 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
8586
87 def launch_and_quit_app(self, database):
88 self.launch_app()
89 self.assertThat(
90 lambda: os.path.exists(database),
91 Eventually(Equals(True))
92 )
93
94 # When calling launch_app an instance of the spawned process
95 # control object will be stored in self.app.process, and a cleanup
96 # handler will be registered that essentially kills the process.
97 # Therefore, by triggering the cleanup handler here we're killing the
98 # process and removing the handler, which allows a clean launch of
99 # the process during regular test setup.
100 self.doCleanups()
101
102 def ensure_db(self):
103 path = os.path.expanduser("~/.local/share/com.ubuntu.weather/Databases")
104 db = os.path.join(path, md5.md5("com.ubuntu.weather").hexdigest() + ".sqlite")
105 if not os.path.exists(db):
106 self.launch_and_quit_app(db)
107
86 def get_qml_view(self):108 def get_qml_view(self):
87 return self.app.select_single("QQuickView")109 return self.app.select_single("QQuickView")
88110
89111
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-12-11 20:24:42 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-12-17 14:44:53 +0000
@@ -27,10 +27,7 @@
27 """ This is needed to wait for the application to start.27 """ This is needed to wait for the application to start.
28 In the testfarm, the application may take some time to show up."""28 In the testfarm, the application may take some time to show up."""
29 def setUp(self):29 def setUp(self):
30 #close app30 self.ensure_db()
31 #logger.debug("Closing app")
32 #self.doCleanups()
33 #wipe the existing database and create a new blank one
34 self.create_blank_db()31 self.create_blank_db()
35 # add settings to storage32 # add settings to storage
36 logger.debug("Adding fake data to new database")33 logger.debug("Adding fake data to new database")

Subscribers

People subscribed via source and target branches