diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 30ae6a457cc..c37ea1dccf1 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -444,7 +444,7 @@ def test_ssl_context_keyfile_exclusive(self): keyfile=CERTFILE, ssl_context=self.create_ssl_context()) -def test_main(): +def load_tests(*args): tests = [TestImaplib] if support.is_resource_enabled('network'): @@ -459,9 +459,9 @@ def test_main(): RemoteIMAPTest, RemoteIMAP_SSLTest, RemoteIMAP_STARTTLSTest, ]) - support.run_unittest(*tests) + return unittest.TestSuite([unittest.makeSuite(test) for test in tests]) if __name__ == "__main__": support.use_resources = ['network'] - test_main() + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS index 82030c98e77..eac45d309d6 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -899,6 +899,9 @@ Tests - Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- Issue #17333: test_imaplib now works with unittest test discovery. + Patch by Zachary Ware. + - Issue #17082: test_dbm* now work with unittest test discovery. Patch by Zachary Ware.