Move email tests to Lib/test package and modernize test runner machinery
This commit is contained in:
parent
76a3d73cbd
commit
cb157ab173
|
@ -1,14 +0,0 @@
|
|||
# Copyright (C) 2001-2007 Python Software Foundation
|
||||
# email package unit tests
|
||||
|
||||
# The specific tests now live in Lib/email/test
|
||||
from email.test.test_email import suite
|
||||
from email.test.test_email_codecs import suite as codecs_suite
|
||||
from test import support
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(suite())
|
||||
support.run_unittest(codecs_suite())
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_main()
|
|
@ -0,0 +1,13 @@
|
|||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import test.support
|
||||
|
||||
# used by regrtest and __main__.
|
||||
def test_main():
|
||||
here = os.path.dirname(__file__)
|
||||
# Unittest mucks with the path, so we have to save and restore
|
||||
# it to keep regrtest happy.
|
||||
savepath = sys.path[:]
|
||||
test.support._run_suite(unittest.defaultTestLoader.discover(here))
|
||||
sys.path[:] = savepath
|
|
@ -0,0 +1,3 @@
|
|||
from test.test_email import test_main
|
||||
|
||||
test_main()
|
|
@ -5,7 +5,7 @@
|
|||
import unittest
|
||||
from test.support import run_unittest
|
||||
|
||||
from email.test.test_email import TestEmailBase
|
||||
from test.test_email.test_email import TestEmailBase
|
||||
from email.charset import Charset
|
||||
from email.header import Header, decode_header
|
||||
from email.message import Message
|
||||
|
@ -77,17 +77,6 @@ Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?=
|
|||
self.assertEqual(jhello, ustr)
|
||||
|
||||
|
||||
|
||||
def suite():
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTest(unittest.makeSuite(TestEmailAsianCodecs))
|
||||
return suite
|
||||
|
||||
|
||||
def test_main():
|
||||
run_unittest(TestEmailAsianCodecs)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main()
|
|
@ -37,7 +37,7 @@ from email import base64mime
|
|||
from email import quoprimime
|
||||
|
||||
from test.support import findfile, run_unittest, unlink
|
||||
from email.test import __file__ as landmark
|
||||
from test.test_email import __file__ as landmark
|
||||
|
||||
|
||||
NL = '\n'
|
||||
|
@ -4142,23 +4142,5 @@ class TestSigned(TestEmailBase):
|
|||
|
||||
|
||||
|
||||
def _testclasses():
|
||||
mod = sys.modules[__name__]
|
||||
return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')]
|
||||
|
||||
|
||||
def suite():
|
||||
suite = unittest.TestSuite()
|
||||
for testclass in _testclasses():
|
||||
suite.addTest(unittest.makeSuite(testclass))
|
||||
return suite
|
||||
|
||||
|
||||
def test_main():
|
||||
for testclass in _testclasses():
|
||||
run_unittest(testclass)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(defaultTest='suite')
|
||||
unittest.main()
|
|
@ -278,6 +278,11 @@ Tools/Demos
|
|||
Tests
|
||||
-----
|
||||
|
||||
- The email test suite now lives in the Lib/test/test_email package. The test
|
||||
harness code has also been modernized to allow use of new unittest features.
|
||||
|
||||
- regrtest now discovers test packages as well as test modules.
|
||||
|
||||
- Issue #11577: improve test coverage of binhex.py. Patch by Arkady Koplyarov.
|
||||
|
||||
- New test_crashers added to exercise the scripts in the Lib/test/crashers
|
||||
|
|
Loading…
Reference in New Issue