Code review comment for lp:~om26er/ubuntu-weather-app/db_stab2

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

Personally I would of done something closer to (only one hardcoded path)

=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-12-17 17:09:10 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-12-17 17:25:10 +0000
@@ -89,13 +89,14 @@
         return self.app.select_single("QQuickView")

     def ensure_db(self):
- db_dir = "~/.local/share/com.ubuntu.weather/Databases/"
+ weather_dir = os.path.expanduser(
+ "~/.local/share/com.ubuntu.weather")
+ db_dir = os.path.join(weather_dir, 'Databases')
         db_file = "34e1e542f2f083ff18f537b07a380071.sqlite"
- abs_path = os.path.expanduser(db_dir)
- db_path = os.path.join(abs_path, db_file)
+ db_path = os.path.join(db_dir, db_file)

         if not os.path.exists(db_path):
- os.makedirs(os.path.expanduser("~/.local/share/com.ubuntu.weather"))
+ os.makedirs(weather_dir)
             shutil.copytree("ubuntu_weather_app/Databases/", db_dir)
             self.assertThat(
                 lambda: os.path.exists(db_path),

« Back to merge proposal