Correctly move email package tests to Lib/test.

This commit is contained in:
R David Murray 2011-03-21 17:17:06 -04:00
parent 76a3d73cbd
commit 9aaba789b3
56 changed files with 22 additions and 47 deletions

View File

@ -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()

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 954 B

After

Width:  |  Height:  |  Size: 954 B

View File

@ -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()

View File

@ -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()

View File

@ -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