Merge lp:~canonical-platform-qa/gallery-app/fix1381273-no_tmp into lp:gallery-app

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~canonical-platform-qa/gallery-app/fix1381273-no_tmp
Merge into: lp:gallery-app
Diff against target: 102 lines (+27/-25)
1 file modified
tests/autopilot/gallery_app/tests/__init__.py (+27/-25)
To merge this branch: bzr merge lp:~canonical-platform-qa/gallery-app/fix1381273-no_tmp
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+238369@code.launchpad.net

This proposal has been superseded by a proposal from 2014-10-15.

Commit message

Do not use temporary directories for autopilot tests.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1103. By Leo Arias

Fixed the year.

Unmerged revisions

1103. By Leo Arias

Fixed the year.

1102. By Leo Arias

Do not use temporary directories for autopilot tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/gallery_app/tests/__init__.py'
2--- tests/autopilot/gallery_app/tests/__init__.py 2014-09-19 04:22:12 +0000
3+++ tests/autopilot/gallery_app/tests/__init__.py 2014-10-15 00:11:22 +0000
4@@ -1,9 +1,20 @@
5 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6-# Copyright 2012 Canonical
7-#
8-# This program is free software: you can redistribute it and/or modify it
9-# under the terms of the GNU General Public License version 3, as published
10-# by the Free Software Foundation.
11+#
12+# Copyright (C) 2014 Canonical Ltd.
13+#
14+# This file is part of gallery-app.
15+#
16+# gallery-app is free software: you can redistribute it and/or modify it under
17+# the terms of the GNU General Public License as published by the Free Software
18+# Foundation; version 3.
19+#
20+# gallery-app is distributed in the hope that it will be useful, but WITHOUT
21+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23+# details.
24+#
25+# You should have received a copy of the GNU General Public License along with
26+# this program. If not, see <http://www.gnu.org/licenses/>.
27
28 """gallery autopilot tests."""
29
30@@ -47,8 +58,6 @@
31 'database/gallery.sqlite'
32 _thumbs = '~/.cache/com.ubuntu.gallery/thumbnails'
33
34- _default_sample_destination_dir = "/tmp/gallery-ap_sd"
35-
36 ARGS = []
37
38 @property
39@@ -76,19 +85,16 @@
40 else:
41 return EnvironmentTypes.click
42
43- def _get_sample_destination_dir(self, env_type):
44- if env_type == EnvironmentTypes.click:
45- pic_dir = os.path.expanduser("~/Pictures")
46- pic_bak_dir = pic_dir + '.apbak'
47- # Only save and restore if it previously existed
48- if os.path.exists(pic_dir):
49- shutil.move(pic_dir, pic_bak_dir)
50- self.addCleanup(
51- logger.debug, "Restoring backed up pics to %s" % pic_dir)
52- self.addCleanup(shutil.move, pic_bak_dir, pic_dir)
53- return pic_dir
54- else:
55- return self._default_sample_destination_dir
56+ def _get_sample_destination_dir(self):
57+ pic_dir = os.path.expanduser("~/Pictures")
58+ pic_bak_dir = pic_dir + '.apbak'
59+ # Only save and restore if it previously existed
60+ if os.path.exists(pic_dir):
61+ shutil.move(pic_dir, pic_bak_dir)
62+ self.addCleanup(
63+ logger.debug, "Restoring backed up pics to %s" % pic_dir)
64+ self.addCleanup(shutil.move, pic_bak_dir, pic_dir)
65+ return pic_dir
66
67 def configure_db(self):
68 db = os.path.expanduser(self._db)
69@@ -117,8 +123,7 @@
70
71 def configure_sample_files(self, env_type):
72 self.sample_dir = resource_filename('gallery_app', 'data')
73- self.sample_destination_dir = \
74- self._get_sample_destination_dir(env_type)
75+ self.sample_destination_dir = self._get_sample_destination_dir()
76 if (os.path.exists(self.sample_destination_dir)):
77 shutil.rmtree(self.sample_destination_dir)
78 self.assertFalse(os.path.exists(self.sample_destination_dir))
79@@ -180,7 +185,6 @@
80
81 def launch_test_local(self):
82 logger.debug("Launching local gallery-app binary.")
83- self.ARGS.append(self.sample_destination_dir)
84 self.app = self.launch_test_application(
85 self.local_location,
86 *self.ARGS,
87@@ -191,7 +195,6 @@
88 logger.debug(
89 "Launching installed gallery-app binary for desktop."
90 )
91- self.ARGS.append(self.sample_destination_dir)
92 self.app = self.launch_test_application(
93 "gallery-app",
94 *self.ARGS,
95@@ -202,7 +205,6 @@
96 )
97 self.ARGS.append("--desktop_file_hint="
98 "/usr/share/applications/gallery-app.desktop")
99- self.ARGS.append(self.sample_destination_dir)
100 self.app = self.launch_test_application(
101 "gallery-app",
102 *self.ARGS,

Subscribers

People subscribed via source and target branches