File: conftest.py

package info (click to toggle)
playerctl 2.4.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 704 kB
  • sloc: ansic: 5,157; python: 1,107; xml: 198; sh: 133; makefile: 62
file content (20 lines) | stat: -rw-r--r-- 515 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pytest
import asyncio


@pytest.fixture()
async def bus_address(scope='class'):
    proc = await asyncio.create_subprocess_shell(
        'dbus-launch', stdout=asyncio.subprocess.PIPE)
    stdout, __ = await proc.communicate()
    await proc.wait()
    assert proc.returncode == 0
    address = None
    for line in stdout.decode().split():
        if line.startswith('DBUS_SESSION_BUS_ADDRESS='):
            address = line.split('=', 1)[1].strip()
            break

    assert address

    return address