1
"""Gallery application to write autopilot test cases easily."""
7
from ubuntu_test_cases.memory_usage_measurement.apps import App
10
class GalleryApp(App):
12
"""Gallery application."""
14
SAMPLE_DIR = '/usr/lib/python2.7/dist-packages/gallery_app/data/default'
16
def __init__(self, tc):
17
super(GalleryApp, self).__init__(tc)
18
self.temp_sample_dir = None
19
self._copy_sample_dir()
21
def _copy_sample_dir(self):
22
"""Copy sample directory to a temporary location.
24
This is useful to provide some default content.
27
self.temp_sample_dir = tempfile.mkdtemp(prefix='gallery-app-test-')
28
self.tc.addCleanup(shutil.rmtree, self.temp_sample_dir)
29
self.temp_sample_dir = os.path.join(self.temp_sample_dir, 'data')
30
shutil.copytree(self.SAMPLE_DIR, self.temp_sample_dir)
33
"""Launch the application."""
36
('--desktop_file_hint='
37
'/usr/share/applications/gallery-app.desktop'),
40
self.app = self.tc.launch_test_application(*args,