Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elParaguayo committed Dec 11, 2024
1 parent a70a665 commit 5b7aae9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions test/widget/test_iwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@

import pytest
from dbus_fast import Variant
from dbus_fast._private.address import get_session_bus_address
from dbus_fast.aio import MessageBus
from dbus_fast.constants import PropertyAccess
from dbus_fast.constants import BusType, PropertyAccess
from dbus_fast.service import ServiceInterface, dbus_property, method
from libqtile.bar import Bar
from libqtile.config import Screen
Expand All @@ -47,6 +46,11 @@
from test.helpers import Retry


class ForceSessionBusType:
SESSION = BusType.SESSION
SYSTEM = BusType.SESSION


class Device(ServiceInterface):
def __init__(self, *args, device_name="", powered=True, **kwargs):
ServiceInterface.__init__(self, IWD_DEVICE, *args, **kwargs)
Expand Down Expand Up @@ -241,12 +245,8 @@ def dbus_thread(monkeypatch):
@pytest.fixture
def widget(monkeypatch):
"""Patch the widget to use the fake dbus service."""

def force_session_bus(bus_type):
return get_session_bus_address()

# Make dbus_fast always return the session bus address even if system bus is requested
monkeypatch.setattr("dbus_fast.message_bus.get_bus_address", force_session_bus)
monkeypatch.setattr("qtile_extras.widget.iwd.BusType", ForceSessionBusType)

yield IWD

Expand Down
2 changes: 1 addition & 1 deletion test/widget/test_mpris2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import libqtile.confreader
import libqtile.layout
import pytest
from dbus_fast import Variant
from dbus_fast.aio import MessageBus
from dbus_fast.constants import PropertyAccess
from dbus_fast.message import Variant
from dbus_fast.service import ServiceInterface, dbus_property, method

import qtile_extras.widget.mpris2widget as mp
Expand Down

0 comments on commit 5b7aae9

Please sign in to comment.