mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
happy python lint
This commit is contained in:
@@ -569,13 +569,13 @@ class IOThreads:
|
|||||||
|
|
||||||
# Make sure the current
|
# Make sure the current
|
||||||
self._start_one_thread("deltachat-log", self.dc_thread_run)
|
self._start_one_thread("deltachat-log", self.dc_thread_run)
|
||||||
|
|
||||||
def is_started(self):
|
def is_started(self):
|
||||||
return lib.dc_is_open(self._dc_context) and lib.dc_is_running(self._dc_context)
|
return lib.dc_is_open(self._dc_context) and lib.dc_is_running(self._dc_context)
|
||||||
|
|
||||||
def start(self, imap=True, smtp=True, mvbox=False, sentbox=False):
|
def start(self, imap=True, smtp=True, mvbox=False, sentbox=False):
|
||||||
assert not self.is_started()
|
assert not self.is_started()
|
||||||
|
|
||||||
lib.dc_context_run(self._dc_context)
|
lib.dc_context_run(self._dc_context)
|
||||||
|
|
||||||
def _start_one_thread(self, name, func):
|
def _start_one_thread(self, name, func):
|
||||||
@@ -606,6 +606,7 @@ class IOThreads:
|
|||||||
|
|
||||||
self._log_event("py-bindings-info", 0, "DC LOG THREAD FINISHED")
|
self._log_event("py-bindings-info", 0, "DC LOG THREAD FINISHED")
|
||||||
|
|
||||||
|
|
||||||
def _destroy_dc_context(dc_context, dc_context_unref=lib.dc_context_unref):
|
def _destroy_dc_context(dc_context, dc_context_unref=lib.dc_context_unref):
|
||||||
# destructor for dc_context
|
# destructor for dc_context
|
||||||
dc_context_unref(dc_context)
|
dc_context_unref(dc_context)
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, datadir):
|
|||||||
wait_successful_IMAP_SMTP_connection(ac2)
|
wait_successful_IMAP_SMTP_connection(ac2)
|
||||||
wait_configuration_progress(ac2, 1000)
|
wait_configuration_progress(ac2, 1000)
|
||||||
ac2.start_threads()
|
ac2.start_threads()
|
||||||
|
|
||||||
return ac1, ac2
|
return ac1, ac2
|
||||||
|
|
||||||
def clone_online_account(self, account, pre_generated_key=True):
|
def clone_online_account(self, account, pre_generated_key=True):
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ class TestOnlineAccount:
|
|||||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||||
ac1.stop_threads()
|
ac1.stop_threads()
|
||||||
ac2.stop_threads()
|
ac2.stop_threads()
|
||||||
|
|
||||||
dir = tmpdir.mkdir("exportdir")
|
dir = tmpdir.mkdir("exportdir")
|
||||||
export_files = ac1.export_self_keys(dir.strpath)
|
export_files = ac1.export_self_keys(dir.strpath)
|
||||||
assert len(export_files) == 2
|
assert len(export_files) == 2
|
||||||
@@ -608,11 +608,11 @@ class TestOnlineAccount:
|
|||||||
lp.sec("ac2: waiting for configuration")
|
lp.sec("ac2: waiting for configuration")
|
||||||
wait_configuration_progress(ac2, 1000)
|
wait_configuration_progress(ac2, 1000)
|
||||||
ac2.start_threads()
|
ac2.start_threads()
|
||||||
|
|
||||||
lp.sec("ac1: waiting for configuration")
|
lp.sec("ac1: waiting for configuration")
|
||||||
wait_configuration_progress(ac1, 1000)
|
wait_configuration_progress(ac1, 1000)
|
||||||
ac1.start_threads()
|
ac1.start_threads()
|
||||||
|
|
||||||
lp.sec("ac1: send message and wait for ac2 to receive it")
|
lp.sec("ac1: send message and wait for ac2 to receive it")
|
||||||
chat = self.get_chat(ac1, ac2)
|
chat = self.get_chat(ac1, ac2)
|
||||||
chat.send_text("message1")
|
chat.send_text("message1")
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from deltachat import capi, cutil, const, set_context_callback, clear_context_callback
|
from deltachat import capi, cutil, const, set_context_callback, clear_context_callback, py_dc_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
|
# from deltachat.account import EventLogger
|
||||||
|
|
||||||
|
|
||||||
class EventThread(threading.Thread):
|
class EventThread(threading.Thread):
|
||||||
@@ -16,11 +16,11 @@ class EventThread(threading.Thread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
lib.dc_context_run(self.dc_context)
|
lib.dc_context_run(self.dc_context)
|
||||||
while self._running:
|
while self._running:
|
||||||
if lib.dc_has_next_event(self.dc_context):
|
if lib.dc_has_next_event(self.dc_context):
|
||||||
event = lib.dc_get_next_event(self.dc_context)
|
event = lib.dc_get_next_event(self.dc_context)
|
||||||
if event != ffi.NULL:
|
if event != ffi.NULL:
|
||||||
deltachat.py_dc_callback(
|
py_dc_callback(
|
||||||
self._dc_context,
|
self._dc_context,
|
||||||
lib.dc_event_get_id(event),
|
lib.dc_event_get_id(event),
|
||||||
lib.dc_event_get_data1(event),
|
lib.dc_event_get_data1(event),
|
||||||
@@ -46,6 +46,7 @@ def test_callback_None2int():
|
|||||||
capi.lib.dc_close(ctx)
|
capi.lib.dc_close(ctx)
|
||||||
clear_context_callback(ctx)
|
clear_context_callback(ctx)
|
||||||
|
|
||||||
|
|
||||||
def test_start_stop_event_thread_basic():
|
def test_start_stop_event_thread_basic():
|
||||||
print("1")
|
print("1")
|
||||||
ctx = capi.lib.dc_context_new(ffi.NULL, ffi.NULL)
|
ctx = capi.lib.dc_context_new(ffi.NULL, ffi.NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user