gh-66335: Add tests for imaplib command methods#152872
Merged
serhiy-storchaka merged 1 commit intoJul 2, 2026
Merged
Conversation
Add coverage tests for the IMAP4 command methods and their UID variants (SELECT, CREATE, COPY, STORE, FETCH, SEARCH, SORT, THREAD, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, STATUS, the ACL and quota commands, ANNOTATION, PROXYAUTH and ENABLE), plus test helpers (splitargs, parse_sequence_set, make_simple_handler) and per-command argument capture in the test server. The tests assert the current wire behavior; a follow-up for pythongh-40038 updates the expected values once argument quoting is restored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-152873 is a backport of this pull request to the 3.15 branch. |
|
GH-152874 is a backport of this pull request to the 3.14 branch. |
|
GH-152875 is a backport of this pull request to the 3.13 branch. |
serhiy-storchaka
added a commit
that referenced
this pull request
Jul 2, 2026
…H-152875) Add coverage tests for the IMAP4 command methods and their UID variants (SELECT, CREATE, COPY, STORE, FETCH, SEARCH, SORT, THREAD, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, STATUS, the ACL and quota commands, ANNOTATION, PROXYAUTH and ENABLE), plus test helpers (splitargs, parse_sequence_set, make_simple_handler) and per-command argument capture in the test server. (cherry picked from commit a50b089) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
serhiy-storchaka
added a commit
that referenced
this pull request
Jul 2, 2026
…H-152873) Add coverage tests for the IMAP4 command methods and their UID variants (SELECT, CREATE, COPY, STORE, FETCH, SEARCH, SORT, THREAD, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, STATUS, the ACL and quota commands, ANNOTATION, PROXYAUTH and ENABLE), plus test helpers (splitargs, parse_sequence_set, make_simple_handler) and per-command argument capture in the test server. (cherry picked from commit a50b089) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
serhiy-storchaka
added a commit
that referenced
this pull request
Jul 2, 2026
…H-152874) Add coverage tests for the IMAP4 command methods and their UID variants (SELECT, CREATE, COPY, STORE, FETCH, SEARCH, SORT, THREAD, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, STATUS, the ACL and quota commands, ANNOTATION, PROXYAUTH and ENABLE), plus test helpers (splitargs, parse_sequence_set, make_simple_handler) and per-command argument capture in the test server. (cherry picked from commit a50b089) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add command-level tests for essentially every
imaplib.IMAP4method, using request/response samples from RFC 3501 and the relevant extension RFCs.Each test drives a real client against an in-process
SimpleIMAPHandler, asserts the exact bytes the server received (via a newsplitargstokenizer that keeps quoted strings and nested parenthesized lists whole), and checks the parsed return value, including the untagged responses for the list-returning commands.Covered:
select(incl.readonly=True→EXAMINE),create,delete,rename,subscribe,unsubscribe,list,lsub,status,copy,fetch,store,search,sort,thread(and theirUIDvariants),expunge,close,check,noop,namespace,capability,recent,response,partial,proxyauth,xatom,enable, and the ACL/QUOTA/ANNOTATION commands.The assertions reflect current behavior only; the argument-quoting fix in #152703 will build on these tests, adjusting the expected wire forms.
append(literal handling) is covered by #152775, andmove()by gh-77508;starttlsneeds a TLS-upgrade test server and is left for separate work.