marking test for broker sys plugin as xfail, because it fails on github workflow but not locally

pull/218/head
Andrew Mirsky 2025-06-14 15:28:46 -04:00
rodzic 92f373db66
commit 364273e684
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A98E67635CDF2C39
1 zmienionych plików z 48 dodań i 46 usunięć

Wyświetl plik

@ -13,49 +13,51 @@ from amqtt.mqtt.constants import QOS_0
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# test broker sys # test broker sys
# @pytest.mark.asyncio @pytest.mark.asyncio
# async def test_broker_sys_plugin() -> None: @pytest.mark.xfail(
# reason="see https://github.com/Yakifo/aio-amqtt/issues/215",
# class MockEntryPoints: strict=False,
# )
# def select(self, group) -> list[EntryPoint]: async def test_broker_sys_plugin() -> None:
# match group:
# case 'tests.mock_plugins': class MockEntryPoints:
# return [
# EntryPoint(name='BrokerSysPlugin', group='tests.mock_plugins', value='amqtt.plugins.sys.broker:BrokerSysPlugin'), def select(self, group) -> list[EntryPoint]:
# ] match group:
# case _: case 'tests.mock_plugins':
# return list() return [
# EntryPoint(name='BrokerSysPlugin', group='tests.mock_plugins', value='amqtt.plugins.sys.broker:BrokerSysPlugin'),
# ]
# with patch("amqtt.plugins.manager.entry_points", side_effect=MockEntryPoints) as mocked_mqtt_publish: case _:
# return list()
# config = {
# "listeners": {
# "default": {"type": "tcp", "bind": "127.0.0.1:1883", "max_connections": 10}, with patch("amqtt.plugins.manager.entry_points", side_effect=MockEntryPoints) as mocked_mqtt_publish:
# },
# 'sys_interval': 1 config = {
# } "listeners": {
# "default": {"type": "tcp", "bind": "127.0.0.1:1883", "max_connections": 10},
# broker = Broker(plugin_namespace='tests.mock_plugins', config=config) },
# await broker.start() 'sys_interval': 1
# client = MQTTClient() }
# await client.connect("mqtt://127.0.0.1:1883/")
# await client.subscribe([("$SYS/broker/uptime", QOS_0),]) broker = Broker(plugin_namespace='tests.mock_plugins', config=config)
# await client.publish('test/topic', b'my test message') await broker.start()
# await asyncio.sleep(2) client = MQTTClient()
# sys_msg_count = 0 await client.connect("mqtt://127.0.0.1:1883/")
# try: await client.subscribe([("$SYS/broker/uptime", QOS_0),])
# while True: await client.publish('test/topic', b'my test message')
# message = await client.deliver_message(timeout_duration=0.5) await asyncio.sleep(2)
# if '$SYS' in message.topic: sys_msg_count = 0
# sys_msg_count += 1 try:
# except asyncio.TimeoutError: while True:
# pass message = await client.deliver_message(timeout_duration=1)
# if '$SYS' in message.topic:
# logger.warning(f">>> sys message: {message.topic} - {message.data}") sys_msg_count += 1
# await client.disconnect() except asyncio.TimeoutError:
# await broker.shutdown() pass
#
# await client.disconnect()
# assert sys_msg_count > 1 await broker.shutdown()
assert sys_msg_count > 1