~chris.gagnon/messaging-app/autopilot-tests-with-contacts

« back to all changes in this revision

Viewing changes to tests/autopilot/messaging_app/tests/test_messaging.py

  • Committer: chris.gagnon
  • Date: 2014-02-12 23:27:18 UTC
  • Revision ID: chris.gagnon@canonical.com-20140212232718-sr41iex4d3m2visf
move ofono-phonesim check into setup()

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from autopilot.introspection import dbus
19
19
from autopilot.matchers import Eventually
20
20
from testtools.matchers import Equals
21
 
from testtools import skipIf, skipUnless
 
21
from testtools import skipIf
22
22
 
23
23
from messaging_app.tests import MessagingAppTestCase
24
24
 
31
31
    have_phonesim = False
32
32
 
33
33
 
34
 
@skipUnless(have_phonesim,
35
 
            'this test needs to run under with-ofono-phonesim')
36
34
@skipIf(os.uname()[2].endswith('maguro'),
37
35
        'tests cause Unity crashes on maguro')
38
36
class TestMessaging(MessagingAppTestCase):
40
38
 
41
39
    def setUp(self):
42
40
 
 
41
        # determine whether we are running with phonesim
 
42
        try:
 
43
            out = subprocess.check_output(
 
44
                ['/usr/share/ofono/scripts/list-modems'],
 
45
                stderr=subprocess.PIPE
 
46
            )
 
47
            have_phonesim = out.startswith('[ /phonesim ]')
 
48
        except subprocess.CalledProcessError:
 
49
            have_phonesim = False
 
50
 
 
51
        self.assertTrue(have_phonesim)
 
52
 
43
53
        # provide clean history
44
54
        self.history = os.path.expanduser(
45
55
            '~/.local/share/history-service/history.sqlite')