Files
playerctl/test/conftest.py
2020-01-25 02:51:49 -05:00

21 lines
515 B
Python

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