Files
playerctl/test/conftest.py
2019-06-03 09:01:56 -04:00

19 lines
510 B
Python

from dbus_next.aio import MessageBus
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()
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