mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 05:56:31 +03:00
Merge branch 'master' into flub-py-glue-fixes
This commit is contained in:
@@ -24,12 +24,23 @@ def pytest_configure(config):
|
||||
config.option.liveconfig = cfg
|
||||
|
||||
|
||||
@pytest.hookimpl(trylast=True)
|
||||
def pytest_runtest_call(item):
|
||||
# perform early finalization because we otherwise get cloberred
|
||||
# output from concurrent threads printing between execution
|
||||
# of the test function and the teardown phase of that test function
|
||||
if "acfactory" in item.funcargs:
|
||||
print("*"*30, "finalizing", "*"*30)
|
||||
acfactory = item.funcargs["acfactory"]
|
||||
acfactory.finalize()
|
||||
|
||||
|
||||
def pytest_report_header(config, startdir):
|
||||
t = tempfile.mktemp()
|
||||
try:
|
||||
ac = Account(t)
|
||||
ac = Account(t, eventlogging=False)
|
||||
info = ac.get_info()
|
||||
del ac
|
||||
ac.shutdown()
|
||||
finally:
|
||||
os.remove(t)
|
||||
summary = ['Deltachat core={} sqlite={}'.format(
|
||||
@@ -64,7 +75,6 @@ def acfactory(pytestconfig, tmpdir, request):
|
||||
self.live_count = 0
|
||||
self.offline_count = 0
|
||||
self._finalizers = []
|
||||
request.addfinalizer(self.finalize)
|
||||
self.init_time = time.time()
|
||||
|
||||
def finalize(self):
|
||||
@@ -90,6 +100,7 @@ def acfactory(pytestconfig, tmpdir, request):
|
||||
ac = Account(tmpdb.strpath, logid="ac{}".format(self.offline_count))
|
||||
ac._evlogger.init_time = self.init_time
|
||||
ac._evlogger.set_timeout(2)
|
||||
self._finalizers.append(ac.shutdown)
|
||||
return ac
|
||||
|
||||
def get_configured_offline_account(self):
|
||||
@@ -115,7 +126,7 @@ def acfactory(pytestconfig, tmpdir, request):
|
||||
ac._evlogger.set_timeout(30)
|
||||
ac.configure(**configdict)
|
||||
ac.start_threads()
|
||||
self._finalizers.append(lambda: ac.stop_threads(wait=False))
|
||||
self._finalizers.append(ac.shutdown)
|
||||
return ac
|
||||
|
||||
def clone_online_account(self, account):
|
||||
@@ -126,7 +137,7 @@ def acfactory(pytestconfig, tmpdir, request):
|
||||
ac._evlogger.set_timeout(30)
|
||||
ac.configure(addr=account.get_config("addr"), mail_pw=account.get_config("mail_pw"))
|
||||
ac.start_threads()
|
||||
self._finalizers.append(lambda: ac.stop_threads(wait=False))
|
||||
self._finalizers.append(ac.shutdown)
|
||||
return ac
|
||||
|
||||
return AccountMaker()
|
||||
|
||||
Reference in New Issue
Block a user