[Python-checkins] cpython: #8315: add automatic unittest test discovery in test.test_email

r.david.murray python-checkins at python.org
Tue Mar 13 23:02:39 CET 2012


http://hg.python.org/cpython/rev/217fdeeaf6e0
changeset:   75610:217fdeeaf6e0
user:        R David Murray <rdmurray at bitdance.com>
date:        Tue Mar 13 18:02:22 2012 -0400
summary:
  #8315: add automatic unittest test discovery in test.test_email

files:
  Lib/test/test_email/__init__.py |  10 ++++++++++
  Misc/NEWS                       |   5 +++++
  2 files changed, 15 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_email/__init__.py b/Lib/test/test_email/__init__.py
--- a/Lib/test/test_email/__init__.py
+++ b/Lib/test/test_email/__init__.py
@@ -5,6 +5,16 @@
 import email
 from test.test_email import __file__ as landmark
 
+# Run all tests in package for '-m unittest test.test_email'
+def load_tests(loader, standard_tests, pattern):
+    this_dir = os.path.dirname(__file__)
+    if pattern is None:
+        pattern = "test*"
+    package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
+    standard_tests.addTests(package_tests)
+    return standard_tests
+
+
 # used by regrtest and __main__.
 def test_main():
     here = os.path.dirname(__file__)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -83,6 +83,11 @@
 - Issue #14259: The finditer() method of re objects did not take any
   keyword arguments, contrary to the documentation.
 
+Tests
+-----
+
+- Issue #8315: (partial fix) python -m unittest test.test_email now works.
+
 
 What's New in Python 3.3.0 Alpha 1?
 ===================================

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list