~nick-dedekind/unity8/indicators.hint-interval

« back to all changes in this revision

Viewing changes to tests/autopilot/unity8/shell/tests/test_notifications.py

  • Committer: Nick Dedekind
  • Date: 2014-03-07 15:54:57 UTC
  • mfrom: (638.1.118 unity8)
  • Revision ID: nicholas.dedekind@gmail.com-20140307155457-f0s1zu5ll2czt3rq
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
2
#
3
3
# Unity Autopilot Test Suite
4
 
# Copyright (C) 2012-2013 Canonical
 
4
# Copyright (C) 2012, 2013, 2014 Canonical
5
5
#
6
6
# This program is free software: you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
33
33
import logging
34
34
import signal
35
35
import subprocess
 
36
import sys
36
37
 
37
38
logger = logging.getLogger(__name__)
38
39
 
 
40
# from __future__ import range
 
41
# (python3's range, is same as python2's xrange)
 
42
if sys.version_info < (3,):
 
43
    range = xrange
 
44
 
39
45
 
40
46
class NotificationsBase(UnityTestCase):
41
47
    """Base class for all notification tests that provides helper methods."""
61
67
            return os.path.dirname(__file__) + "/../../../../../qml/graphics/" + icon_name
62
68
 
63
69
    def _get_notifications_list(self):
64
 
        main_view = self.main_window.get_qml_view()
65
 
        return main_view.select_single(
 
70
        return self.main_window.select_single(
66
71
            "Notifications",
67
72
            objectName='notificationList'
68
73
        )
262
267
            stdout=subprocess.PIPE,
263
268
            stderr=subprocess.PIPE,
264
269
            close_fds=True,
 
270
            universal_newlines=True,
265
271
        )
266
272
 
267
273
        self.addCleanup(self._tidy_up_script_process)
299
305
        if self._notify_proc is None:
300
306
            raise AssertionError("No interactive notification was created.")
301
307
 
302
 
        for i in xrange(timeout):
 
308
        for i in range(timeout):
303
309
            self._notify_proc.poll()
304
310
            if self._notify_proc.returncode is not None:
305
311
                output = self._notify_proc.communicate()