mirror of
https://github.com/chatmail/core.git
synced 2026-05-21 15:56:30 +03:00
Always call print_imap_structure when test fails
This commit is contained in:
@@ -95,8 +95,9 @@ def make_direct_imap(account, folder):
|
|||||||
return imap
|
return imap
|
||||||
|
|
||||||
def print_imap_structure(database):
|
def print_imap_structure(database):
|
||||||
ac = Account(database)
|
print_imap_structure_ac(Account(database))
|
||||||
ac.disable_logging()
|
|
||||||
|
def print_imap_structure_ac(ac):
|
||||||
print("================= ACCOUNT", ac.get_config("addr"), "=================")
|
print("================= ACCOUNT", ac.get_config("addr"), "=================")
|
||||||
print("----------------- CONFIG: -----------------")
|
print("----------------- CONFIG: -----------------")
|
||||||
print(ac.get_info())
|
print(ac.get_info())
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import tempfile
|
|||||||
import pytest
|
import pytest
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from . import Account, const
|
from . import Account, const, direct_imap
|
||||||
from .capi import lib
|
from .capi import lib
|
||||||
from .events import FFIEventLogger, FFIEventTracker
|
from .events import FFIEventLogger, FFIEventTracker
|
||||||
from _pytest._code import Source
|
from _pytest._code import Source
|
||||||
@@ -379,7 +379,10 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data):
|
|||||||
|
|
||||||
am = AccountMaker()
|
am = AccountMaker()
|
||||||
request.addfinalizer(am.finalize)
|
request.addfinalizer(am.finalize)
|
||||||
return am
|
yield am
|
||||||
|
if request.node.rep_call.failed:
|
||||||
|
for ac in am._accounts:
|
||||||
|
direct_imap.print_imap_structure_ac(ac)
|
||||||
|
|
||||||
|
|
||||||
class BotProcess:
|
class BotProcess:
|
||||||
@@ -448,3 +451,15 @@ def lp():
|
|||||||
def step(self, msg):
|
def step(self, msg):
|
||||||
print("-" * 5, "step " + msg, "-" * 5)
|
print("-" * 5, "step " + msg, "-" * 5)
|
||||||
return Printer()
|
return Printer()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
|
||||||
|
def pytest_runtest_makereport(item, call):
|
||||||
|
# execute all other hooks to obtain the report object
|
||||||
|
outcome = yield
|
||||||
|
rep = outcome.get_result()
|
||||||
|
|
||||||
|
# set a report attribute for each phase of a call, which can
|
||||||
|
# be "setup", "call", "teardown"
|
||||||
|
|
||||||
|
setattr(item, "rep_" + rep.when, rep)
|
||||||
|
|||||||
Reference in New Issue
Block a user