mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
another bug fix
This commit is contained in:
@@ -29,7 +29,7 @@ class EventLogger:
|
|||||||
|
|
||||||
def consume_events(self, check_error=True):
|
def consume_events(self, check_error=True):
|
||||||
while not self._event_queue.empty():
|
while not self._event_queue.empty():
|
||||||
self.get()
|
self.get(check_error=check_error)
|
||||||
|
|
||||||
def get(self, timeout=None, check_error=True):
|
def get(self, timeout=None, check_error=True):
|
||||||
timeout = timeout or self._timeout
|
timeout = timeout or self._timeout
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from __future__ import print_function
|
|||||||
from deltachat import capi, cutil, const, set_context_callback, clear_context_callback
|
from deltachat import capi, cutil, const, set_context_callback, clear_context_callback
|
||||||
from deltachat.capi import ffi
|
from deltachat.capi import ffi
|
||||||
from deltachat.capi import lib
|
from deltachat.capi import lib
|
||||||
from deltachat.account import EventLogger
|
|
||||||
|
|
||||||
|
|
||||||
def test_empty_context():
|
def test_empty_context():
|
||||||
@@ -18,21 +17,13 @@ def test_callback_None2int():
|
|||||||
|
|
||||||
|
|
||||||
def test_dc_close_events(tmpdir):
|
def test_dc_close_events(tmpdir):
|
||||||
ctx = ffi.gc(
|
from deltachat.account import Account
|
||||||
capi.lib.dc_context_new(capi.lib.py_dc_callback, ffi.NULL, ffi.NULL),
|
|
||||||
lib.dc_context_unref,
|
|
||||||
)
|
|
||||||
evlog = EventLogger(ctx)
|
|
||||||
evlog.set_timeout(5)
|
|
||||||
set_context_callback(
|
|
||||||
ctx,
|
|
||||||
lambda ctx, evt_name, data1, data2: evlog(evt_name, data1, data2)
|
|
||||||
)
|
|
||||||
p = tmpdir.join("hello.db")
|
p = tmpdir.join("hello.db")
|
||||||
lib.dc_open(ctx, p.strpath.encode("ascii"), ffi.NULL)
|
ac1 = Account(p.strpath)
|
||||||
capi.lib.dc_close(ctx)
|
ac1.shutdown()
|
||||||
|
|
||||||
def find(info_string):
|
def find(info_string):
|
||||||
|
evlog = ac1._evlogger
|
||||||
while 1:
|
while 1:
|
||||||
ev = evlog.get_matching("DC_EVENT_INFO", check_error=False)
|
ev = evlog.get_matching("DC_EVENT_INFO", check_error=False)
|
||||||
data2 = ev[2]
|
data2 = ev[2]
|
||||||
|
|||||||
Reference in New Issue
Block a user