test: add indexer unit tests + integration marker; make indexer importable without env
- pytest.ini: 'integration' marker, deselected by default; the integration suite requires a live Qdrant and will only run in the nightly CI job. - src/indexer.py: move env validation from import time into _validate_config() called by main() — the module can now be imported without MAILDIR_PATH / QDRANT_URL / COLLECTION_NAME set, enabling unit tests. - tests/test_indexer.py: 27 new unit tests, no network and no model: decode_mime_words (encoded-words utf-8/iso-8859-1, mixed), extract_text_from_html (tags, scripts), normalize_email_address, parse_email_message with real EmailMessage objects (plain bodies, attachments detected and excluded from body, HTML alternative, unknown charset fallback via raw bytes message, encoded attachment filename), get_recent_keys against a real tmp_path Maildir (fresh mtime selected, old mtime excluded, colon-suffix keys). mailbox.Maildir(create=True) does not create cur/new/tmp on Python 3.11 — the test helper pre-creates them.
This commit is contained in:
1 parent
6b17ca4ad5
commit
e32806aab9
3 files changed
+248
-11
No files matched your search
@@ -1,3 +1,8 @@
|
||||
[pytest]
|
||||
testpaths = tests
|
||||
pythonpath = src
|
||||
; Integration tests (tests/test_integration.py) require a live Qdrant on
|
||||
; localhost:6333 — they only run in the nightly CI job (or manually with -m integration).
|
||||
markers =
|
||||
integration: requires a live Qdrant instance (deselected by default)
|
||||
addopts = -m "not integration" -p no:cacheprovider
|
||||
Reference in new issue
Block a user