summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-04-15 22:14:06 (GMT)
committerBarry Warsaw <barry@python.org>2002-04-15 22:14:06 (GMT)
commitc9ad32c5d14f0ebd635e61b33b6d7d5a12440c1e (patch)
treea27b610ec09cb1fb2377d606e545f1682a4a7603 /Lib/test
parent24fd0252c474bb1e4189dd6b92e572343f27f0f9 (diff)
downloadcpython-c9ad32c5d14f0ebd635e61b33b6d7d5a12440c1e.zip
cpython-c9ad32c5d14f0ebd635e61b33b6d7d5a12440c1e.tar.gz
cpython-c9ad32c5d14f0ebd635e61b33b6d7d5a12440c1e.tar.bz2
test_main(): Added this so the test can actually get run under the
regrtest framework. Keep the original standalone-unittest scaffolding (i.e. suite() and __main__).
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_email.py33
-rw-r--r--Lib/test/test_email_codecs.py8
2 files changed, 20 insertions, 21 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index 1322246..efbe271 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -29,8 +29,10 @@ from email import Iterators
from email import base64MIME
from email import quopriMIME
+import test_support
from test_support import findfile, __file__ as test_support_file
+
NL = '\n'
EMPTYSTRING = ''
SPACE = ' '
@@ -1573,30 +1575,23 @@ class TestHeader(unittest.TestCase):
+def _testclasses():
+ mod = sys.modules[__name__]
+ return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')]
+
+
def suite():
suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestMessageAPI))
- suite.addTest(unittest.makeSuite(TestEncoders))
- suite.addTest(unittest.makeSuite(TestLongHeaders))
- suite.addTest(unittest.makeSuite(TestFromMangling))
- suite.addTest(unittest.makeSuite(TestMIMEAudio))
- suite.addTest(unittest.makeSuite(TestMIMEImage))
- suite.addTest(unittest.makeSuite(TestMIMEText))
- suite.addTest(unittest.makeSuite(TestMultipartMixed))
- suite.addTest(unittest.makeSuite(TestNonConformant))
- suite.addTest(unittest.makeSuite(TestRFC2047))
- suite.addTest(unittest.makeSuite(TestMIMEMessage))
- suite.addTest(unittest.makeSuite(TestIdempotent))
- suite.addTest(unittest.makeSuite(TestMiscellaneous))
- suite.addTest(unittest.makeSuite(TestIterators))
- suite.addTest(unittest.makeSuite(TestParsers))
- suite.addTest(unittest.makeSuite(TestBase64))
- suite.addTest(unittest.makeSuite(TestQuopri))
- suite.addTest(unittest.makeSuite(TestHeader))
- suite.addTest(unittest.makeSuite(TestCharset))
+ for testclass in _testclasses():
+ suite.addTest(unittest.makeSuite(testclass))
return suite
+def test_main():
+ for testclass in _testclasses():
+ test_support.run_unittest(testclass)
+
+
if __name__ == '__main__':
unittest.main(defaultTest='suite')
diff --git a/Lib/test/test_email_codecs.py b/Lib/test/test_email_codecs.py
index d0451d1..3a133e8 100644
--- a/Lib/test/test_email_codecs.py
+++ b/Lib/test/test_email_codecs.py
@@ -2,7 +2,7 @@
# email package unit tests for (optional) Asian codecs
import unittest
-from test_support import TestSkipped
+import test_support
from email.Charset import Charset
from email.Header import Header, decode_header
@@ -12,7 +12,7 @@ from email.Header import Header, decode_header
try:
unicode('foo', 'japanese.iso-2022-jp')
except LookupError:
- raise TestSkipped, 'Optional Japanese codecs not installed'
+ raise test_support.TestSkipped, 'Optional Japanese codecs not installed'
@@ -46,6 +46,10 @@ def suite():
return suite
+def test_main():
+ test_support.run_unittest(TestEmailAsianCodecs)
+
+
if __name__ == '__main__':
unittest.main(defaultTest='suite')