remove imap_tools from dependencies (#6238)

This commit is contained in:
adb
2024-11-23 16:28:23 +01:00
committed by GitHub
parent daeeca3710
commit 407bc95ae5
5 changed files with 15 additions and 20 deletions

View File

@@ -25,7 +25,8 @@ $ pip install .
## Testing ## Testing
1. Build `deltachat-rpc-server` with `cargo build -p deltachat-rpc-server`. 1. Build `deltachat-rpc-server` with `cargo build -p deltachat-rpc-server`.
2. Run `CHATMAIL_DOMAIN=nine.testrun.org PATH="../target/debug:$PATH" tox`. 2. Install tox `pip install -U tox`
3. Run `CHATMAIL_DOMAIN=nine.testrun.org PATH="../target/debug:$PATH" tox`.
Additional arguments to `tox` are passed to pytest, e.g. `tox -- -s` does not capture test output. Additional arguments to `tox` are passed to pytest, e.g. `tox -- -s` does not capture test output.

View File

@@ -24,9 +24,6 @@ classifiers = [
"Topic :: Communications :: Email" "Topic :: Communications :: Email"
] ]
readme = "README.md" readme = "README.md"
dependencies = [
"imap-tools",
]
[tool.setuptools.package-data] [tool.setuptools.package-data]
deltachat_rpc_client = [ deltachat_rpc_client = [

View File

@@ -1,7 +1,3 @@
"""
Internal Python-level IMAP handling used by the tests.
"""
from __future__ import annotations from __future__ import annotations
import imaplib import imaplib
@@ -11,17 +7,11 @@ import ssl
from contextlib import contextmanager from contextlib import contextmanager
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from imap_tools import ( import pytest
AND, from imap_tools import AND, Header, MailBox, MailMessage, MailMessageFlags, errors
Header,
MailBox,
MailMessage,
MailMessageFlags,
errors,
)
if TYPE_CHECKING: if TYPE_CHECKING:
from . import Account from deltachat_rpc_client import Account
FLAGS = b"FLAGS" FLAGS = b"FLAGS"
FETCH = b"FETCH" FETCH = b"FETCH"
@@ -29,6 +19,8 @@ ALL = "1:*"
class DirectImap: class DirectImap:
"""Internal Python-level IMAP handling."""
def __init__(self, account: Account) -> None: def __init__(self, account: Account) -> None:
self.account = account self.account = account
self.logid = account.get_config("displayname") or id(account) self.logid = account.get_config("displayname") or id(account)
@@ -212,3 +204,8 @@ class IdleManager:
def done(self): def done(self):
"""send idle-done to server if we are currently in idle mode.""" """send idle-done to server if we are currently in idle mode."""
return self.direct_imap.conn.idle.stop() return self.direct_imap.conn.idle.stop()
@pytest.fixture
def direct_imap():
return DirectImap

View File

@@ -12,7 +12,6 @@ import pytest
from deltachat_rpc_client import Contact, EventType, Message, events from deltachat_rpc_client import Contact, EventType, Message, events
from deltachat_rpc_client.const import DownloadState, MessageState from deltachat_rpc_client.const import DownloadState, MessageState
from deltachat_rpc_client.direct_imap import DirectImap
from deltachat_rpc_client.rpc import JsonRpcError from deltachat_rpc_client.rpc import JsonRpcError
@@ -536,7 +535,7 @@ def test_reaction_to_partially_fetched_msg(acfactory, tmp_path):
assert list(reactions.reactions_by_contact.values())[0] == [react_str] assert list(reactions.reactions_by_contact.values())[0] == [react_str]
def test_reactions_for_a_reordering_move(acfactory): def test_reactions_for_a_reordering_move(acfactory, direct_imap):
"""When a batch of messages is moved from Inbox to DeltaChat folder with a single MOVE command, """When a batch of messages is moved from Inbox to DeltaChat folder with a single MOVE command,
their UIDs may be reordered (e.g. Gmail is known for that) which led to that messages were their UIDs may be reordered (e.g. Gmail is known for that) which led to that messages were
processed by receive_imf in the wrong order, and, particularly, reactions were processed before processed by receive_imf in the wrong order, and, particularly, reactions were processed before
@@ -560,7 +559,7 @@ def test_reactions_for_a_reordering_move(acfactory):
msg1.send_reaction(react_str).wait_until_delivered() msg1.send_reaction(react_str).wait_until_delivered()
logging.info("moving messages to ac2's DeltaChat folder in the reverse order") logging.info("moving messages to ac2's DeltaChat folder in the reverse order")
ac2_direct_imap = DirectImap(ac2) ac2_direct_imap = direct_imap(ac2)
ac2_direct_imap.connect() ac2_direct_imap.connect()
for uid in sorted([m.uid for m in ac2_direct_imap.get_all_messages()], reverse=True): for uid in sorted([m.uid for m in ac2_direct_imap.get_all_messages()], reverse=True):
ac2_direct_imap.conn.move(uid, "DeltaChat") ac2_direct_imap.conn.move(uid, "DeltaChat")

View File

@@ -16,6 +16,7 @@ deps =
pytest pytest
pytest-timeout pytest-timeout
pytest-xdist pytest-xdist
imap-tools
[testenv:lint] [testenv:lint]
skipsdist = True skipsdist = True