tests.test_mail_integration moduleΒΆ
End-to-end behavior of mail parsing, timestamps and hashing, through mdedup.
Unit-level tests of the mail object live in test_mail.py.
- tests.test_mail_integration.DATELESS_HASH_HEADERS = ('--hash-header=message-id', '--hash-header=from', '--hash-header=to', '--hash-header=subject')ΒΆ
Four headers every test mail carries, and no
Date: mails that differ by their date alone land in the same duplicate set.
- tests.test_mail_integration.test_invalid_date_parsing(invoke, make_box, hash_headers, remaining)[source]ΒΆ
Mails with odd non-standard dates are parsed and grouped into duplicate sets.
- tests.test_mail_integration.undated_mail = <tests.conftest.MailFactory object>ΒΆ
A mail whose
Dateheader cannot be parsed into a timestamp.
- tests.test_mail_integration.dated_mail = <tests.conftest.MailFactory object>ΒΆ
A mail with a valid
Dateheader.
- tests.test_mail_integration.test_missing_date_header_skips_time_strategy(invoke, tmp_path)[source]ΒΆ
Duplicates with no
Dateheader are skipped by time-based strategies.Some clients save such mails into mbox files. The run does not crash, and names the offending mail rather than failing the whole mailbox silently.
See: https://github.com/kdeldycke/mail-deduplicate/issues/600 and https://github.com/kdeldycke/mail-deduplicate/issues/954
- tests.test_mail_integration.test_unparsable_date_skips_time_strategy(invoke, make_box, mails, args)[source]ΒΆ
Time-based strategies skip sets holding mails with no parseable
Dateheader.They name the offending mails instead of crashing.
See: https://github.com/kdeldycke/mail-deduplicate/issues/132
- tests.test_mail_integration.test_unparsable_date_show_diff(invoke, make_box)[source]ΒΆ
Rendering the diff of mails with no parseable
Dateheader does not crash.
- tests.test_mail_integration.test_hash_body(invoke, make_box, hash_body, other_body, deduplicated)[source]ΒΆ
βhash-body=skip groups mails by their headers alone, whatever their bodies.
=raw folds every byte of the body into the hash, =decoded folds in its decoded text, and =normalized folds it in but ignores whitespace.
- tests.test_mail_integration.test_ctime_time_source(invoke, make_box)[source]ΒΆ
βtime-source=ctime dates each mail by the inode change time of its file.
A maildir with distinct file ctimes deduplicates by them.
- tests.test_mail_integration.test_mtime_time_source(invoke, make_box)[source]ΒΆ
βtime-source=mtime dates each mail by the modification time of its file.
The copy dated newest is touched first, so its ctime is the oldest: only the modification times pick it.
- tests.test_mail_integration.test_mail_with_too_few_headers_is_kept(invoke, tmp_path, action, left_in_box, exported, jobs)[source]ΒΆ
A mail with fewer than the minimal hashable headers gets no hash, and is kept.
It joins no duplicate set, so no strategy rules on it: every action treats it as a mail without duplicates. A copy or a move carries it into the export box, and no deletion removes it. Covers the hashing in worker processes too, which sends the verdict back as a string.
See: https://github.com/kdeldycke/mail-deduplicate/issues/27
- tests.test_mail_integration.test_crlf_and_lf_bodies_are_duplicates(invoke, tmp_path, args)[source]ΒΆ
Two mails that differ only by LF or CRLF line endings are duplicates.
Line endings must not count toward size or content differences, nor toward the bytes the conservative preset compares.
See: https://github.com/kdeldycke/mail-deduplicate/issues/844 (fixed by PR 845).