~cyphermox/python-dbusmock/bluez4

« back to all changes in this revision

Viewing changes to tests/test_upower.py

  • Committer: Martin Pitt
  • Date: 2014-07-16 11:09:43 UTC
  • Revision ID: git-v1:94ed7b6a933ea3dba5f9aa7e5ee6245bf796a06c
Fix upower tests to work for upower 0.99 in environments without a system D-BUS

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    p = subprocess.Popen(['upower', '--version'], stdout=subprocess.PIPE,
34
34
                         universal_newlines=True)
35
35
    out = p.communicate()[0]
36
 
    upower_client_version = out.splitlines()[0].split()[-1]
37
 
    assert p.returncode == 0
 
36
    try:
 
37
        upower_client_version = out.splitlines()[0].split()[-1]
 
38
        assert p.returncode == 0
 
39
    except IndexError:
 
40
        # FIXME: this happens in environments without a system D-BUS; upower
 
41
        # 0.9 still prints the client version, 0.99 just crashes
 
42
        upower_client_version = '0.99'
38
43
else:
39
44
    upower_client_version = 0
40
45