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" WEBXDC_INSTANCE_DELETED = "WebxdcInstanceDeleted"
CHATLIST_CHANGED = "ChatlistChanged" CHATLIST_CHANGED = "ChatlistChanged"
CHATLIST_ITEM_CHANGED = "ChatlistItemChanged" CHATLIST_ITEM_CHANGED = "ChatlistItemChanged"
TEST_CHECKPOINT_EVENT = "TestCheckpointEvent"
class ChatId(IntEnum): class ChatId(IntEnum):

View File

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