update python (does not work yet)

I get a few errors:
```
FAILED tests/test_chatlist_events.py::test_delivery_status - AttributeError: 'dict' object has no attribute 'kind'
FAILED tests/test_chatlist_events.py::test_delivery_status_failed - AttributeError: 'dict' object has no attribute 'kind'
FAILED tests/test_chatlist_events.py::test_multidevice_sync_chat - AttributeError: 'dict' object has no attribute 'kind'
FAILED tests/test_chatlist_events.py::test_download_on_demand - AttributeError: 'dict' object has no attribute 'kind'
FAILED tests/test_chatlist_events.py::test_imap_sync_seen_msgs - AttributeError: 'dict' object has no attribute 'kind'
```
This commit is contained in:
Simon Laux
2024-04-19 04:31:38 +02:00
parent 4cae52a282
commit c5ae81eea4
2 changed files with 9 additions and 7 deletions

View File

@@ -61,6 +61,7 @@ class EventType(str, Enum):
WEBXDC_INSTANCE_DELETED = "WebxdcInstanceDeleted"
CHATLIST_CHANGED = "ChatlistChanged"
CHATLIST_ITEM_CHANGED = "ChatlistItemChanged"
TEST_CHECKPOINT_EVENT = "TestCheckpointEvent"
class ChatId(IntEnum):

View File

@@ -6,10 +6,12 @@ import logging
import os
import subprocess
import sys
from queue import Empty, Queue
from queue import Queue
from threading import Event, Thread
from typing import Any, Iterator, Optional
from .const import EventType
class JsonRpcError(Exception):
pass
@@ -190,12 +192,11 @@ class Rpc:
def clear_all_events(self, account_id: int):
"""Removes all queued-up events for a given account. Useful for tests."""
queue = self.get_queue(account_id)
try:
while True:
queue.get_nowait()
except Empty:
pass
id = self.trigger_checkpoint_event(account_id)
while True:
event = self.wait_for_event(account_id)
if event.kind == EventType.TEST_CHECKPOINT_EVENT and event.id == id:
break
def __getattr__(self, attr: str):
return RpcMethod(self, attr)