test: cleanup and allow a repo-root level "pytest -n6" to succeed.

the fixtures from chatmaild and cmdeploy test plugins were clashing,
and the "rpc" fixture was shadowed by deltachat-rpc-client.
We could change the way plugins load but it's also useful to have
disambiguated fixture names as we are often working across the code bases.

also removes a few unused historic fluff.
This commit is contained in:
holger krekel
2026-08-26 19:22:39 +02:00
parent ae6b89f936
commit fa24dd17de
8 changed files with 28 additions and 33 deletions
-1
View File
@@ -28,7 +28,6 @@ dependencies = [
cmdeploy = "cmdeploy.cmdeploy:main"
[project.entry-points.pytest11]
"chatmaild.testplugin" = "chatmaild.tests.plugin"
"cmdeploy.testplugin" = "cmdeploy.tests.plugin"
[tool.pytest.ini_options]
@@ -20,17 +20,17 @@ def test_fastcgi_working(maildomain, chatmail_config):
@pytest.mark.filterwarnings("ignore::urllib3.exceptions.InsecureRequestWarning")
def test_newemail_configure(maildomain, rpc, chatmail_config):
def test_newemail_configure(maildomain, cmrpc, chatmail_config):
"""Test configuring accounts by scanning a QR code works."""
url = f"DCACCOUNT:https://{maildomain}/new"
for i in range(3):
account_id = rpc.add_account()
account_id = cmrpc.add_account()
if chatmail_config.tls_cert_mode == "self":
# deltachat core's rustls rejects self-signed HTTPS certs during
# set_config_from_qr, so fetch credentials via requests instead
res = requests.post(f"https://{maildomain}/new", verify=False)
data = res.json()
rpc.add_or_update_transport(account_id, {
cmrpc.add_or_update_transport(account_id, {
"addr": data["email"],
"password": data["password"],
"imapServer": maildomain,
@@ -38,4 +38,4 @@ def test_newemail_configure(maildomain, rpc, chatmail_config):
"certificateChecks": "acceptInvalidCertificates",
})
else:
rpc.add_transport_from_qr(account_id, url)
cmrpc.add_transport_from_qr(account_id, url)
+8 -10
View File
@@ -18,14 +18,8 @@ def format_mail_domain(raw_domain: str) -> str:
return raw_domain
conftestdir = Path(__file__).parent
def pytest_configure(config):
config._benchresults = {}
config.addinivalue_line(
"markers", "slow: mark test to require --slow option to run"
)
def _get_chatmail_config():
@@ -377,8 +371,12 @@ class ChatmailACFactory:
@pytest.fixture(scope="session")
def rpc(tmp_path_factory):
"""Start a deltachat-rpc-server process for the test session."""
def cmrpc(tmp_path_factory):
"""Start a deltachat-rpc-server process for the test session.
Not named "rpc": the deltachat-rpc-client pytest plugin registers a
function-scoped fixture under that name and would shadow this one.
"""
# NB: accounts_dir must NOT already exist as directory --
# core-rust only creates accounts.toml if the dir doesn't exist yet.
@@ -390,10 +388,10 @@ def rpc(tmp_path_factory):
@pytest.fixture
def cmfactory(rpc, gencreds, maildomain, chatmail_config):
def cmfactory(cmrpc, gencreds, maildomain, chatmail_config):
"""Return a ChatmailACFactory for creating online Delta Chat accounts."""
return ChatmailACFactory(
rpc=rpc,
rpc=cmrpc,
maildomain=maildomain,
gencreds=gencreds,
chatmail_config=chatmail_config,
-2
View File
@@ -1,2 +0,0 @@
[pytest]
addopts = -vrsx --strict-markers