This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: refactor imaplib tests
Type: enhancement Stage: resolved
Components: email Versions: Python 3.7, Python 3.6, Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: maciej.szulik Nosy List: barry, maciej.szulik, python-dev, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-11-09 22:16 by maciej.szulik, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
new_imap_tests.diff maciej.szulik, 2015-11-09 22:16 Initial proposal for imap tests review
new_imap_tests_v2.diff maciej.szulik, 2016-01-13 22:13 Tests with comments from David + with rewriten old tests
new_imap_tests_v3.diff maciej.szulik, 2016-01-20 22:14
new_imap_tests_v3.diff serhiy.storchaka, 2016-01-21 10:30 Re-generated for review review
new_imap_tests_v4.diff maciej.szulik, 2016-05-26 23:04 review
new_imap_tests_v5.diff maciej.szulik, 2016-09-30 20:44 review
Messages (14)
msg254417 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2015-11-09 22:16
Our current imaplib implementation lacks quite a few of tests and the ones present are written in different styles. I'd like to propose rewriting the test case with this new style I've developed during PyCon sprints along with David. Once we'll have the entire test suite in place it'll be safer to introduce any changes I'd like to cover, including updating the implementation to newest RFC 3501 version.
msg256070 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2015-12-07 21:30
I've just found the original issue where I wanted to submit the new tests. I'm closing this in favor of
msg256394 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2015-12-14 16:40
I'm reopening this issue per discussion with David we've had on IRC. The scope of this issue to refactor current tests to make them more readable and clean. The most important work is:
1. having single _setup method 
2. the _setup method should addClenup to clean the environment
3. have stubs with implemented mostly used methods, all others should be implemented ad-hoc in test methods
4. use unittest.main() for running tests

We'll do it along current tests to show the improvement. Once we reach satisfactory level we will remove the old tests. This issue is to show this progress.
msg258175 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2016-01-13 22:13
David can you please take a look once more, I've applied all the changes you've asked for. I'm currently working on adding the existing tests rewritten to use the new framework so it's easy to compare. It's still in progress but the general idea should maintain.
msg258723 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2016-01-20 22:14
David I think I've re-implemented, using the new style, all the methods from ThreadedNetworkedTests and ThreadedNetworkedTestsSSL, the new classes are NewIMAPTests and NewIMAPSSLTests accordingly.
msg266460 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2016-05-26 23:04
David I'm uploading the patch with all the review comments addressed. The changes from just the review can be seen here: (please ignore the changes to test_logincapa_withclient_certfile, these are not part of the final patch).
msg270798 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-07-19 00:27
Reitveld can diff patchsets, so I used that for review.
msg270814 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2016-07-19 06:54
Thanks, I'll try to update the patch in the following days.
msg277771 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2016-09-30 20:44
David I apologize for 2 emails from Reitveld, for some reason it didn't show me all in one view :/ (I need to master Reitveld better). I've just updated patch according to your comments.
msg282357 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-04 20:12
Revised patch LGTM.  Once 3.6 is out the door I'll commit it, though you may need to remind me.
msg282411 - (view) Author: Maciej Szulik (maciej.szulik) * (Python triager) Date: 2016-12-05 10:34
Thank you David, of course I'll remind you :)
msg283980 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-12-25 02:35
New changeset 75f9cca86fa1 by R David Murray in branch '3.5':
#25591: improve imap tests.

New changeset 4663466b0d66 by R David Murray in branch '3.6':
Merge: #25591: improve imap tests.

New changeset 93d8cce449eb by R David Murray in branch 'default':
Merge: #25591: improve imap tests.
msg283981 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-25 02:39
Committed.  FYI, I did have to make a few tweaks.  There were several lines longer than 80 characters still that I wrapped.  The tests failed with -W error:BytesWarning, something I normally run the tests with.  That required a fix to the library (a decode on the error message...if anyone is depending on the error message being bytes instead of string I'm sorry, but I doubt anyone is.  And finally, committing to 3.6 required adding the 'r' prefix to some of the tests regexes to eliminate the invalid escape warnings.

Thanks for your patience and persistence, Maciej.
msg285302 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2017-01-12 10:54
New changeset a10d6ab65b23 by Victor Stinner in branch '3.5':
Issue #25591: Fix test_imaplib if ssl miss
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69777
2017-01-12 10:54:19python-devsetmessages: + msg285302
2016-12-25 02:39:55r.david.murraysetstatus: open -> closed
versions: + Python 3.5
messages: + msg283981

resolution: fixed
stage: commit review -> resolved
2016-12-25 02:35:34python-devsetnosy: + python-dev
messages: + msg283980
2016-12-05 10:34:58maciej.szuliksetmessages: + msg282411
2016-12-04 20:13:27r.david.murraysetversions: + Python 3.6
2016-12-04 20:12:33r.david.murraysetstage: patch review -> commit review
messages: + msg282357
versions: + Python 3.7, - Python 3.6
2016-09-30 20:44:52maciej.szuliksetfiles: + new_imap_tests_v5.diff

messages: + msg277771
2016-09-23 20:02:58maciej.szuliksethgrepos: - hgrepo322
2016-07-19 06:54:30maciej.szuliksetmessages: + msg270814
2016-07-19 00:27:28r.david.murraysetmessages: + msg270798
2016-05-26 23:04:11maciej.szuliksetfiles: + new_imap_tests_v4.diff

messages: + msg266460
2016-01-21 10:30:46serhiy.storchakasetfiles: + new_imap_tests_v3.diff
2016-01-21 10:28:08serhiy.storchakasetnosy: + serhiy.storchaka
2016-01-20 22:14:10maciej.szuliksetfiles: + new_imap_tests_v3.diff

messages: + msg258723
stage: patch review
2016-01-13 22:13:12maciej.szuliksetfiles: + new_imap_tests_v2.diff
keywords: + patch
messages: + msg258175
2015-12-14 16:40:09maciej.szuliksetstatus: closed -> open

superseder: Test imaplib API on all methods specified in RFC 3501 ->
assignee: maciej.szulik
title: improve test coverage for the imaplib -> refactor imaplib tests
keywords: - patch
messages: + msg256394
resolution: duplicate -> (no value)
2015-12-07 21:36:41maciej.szuliksetsuperseder: Test imaplib API on all methods specified in RFC 3501
2015-12-07 21:30:32maciej.szuliksetstatus: open -> closed
resolution: duplicate
messages: + msg256070
2015-11-09 22:16:47maciej.szulikcreate