------------------------------------------------------------
revno: 6511
committer: Barry Warsaw <[EMAIL PROTECTED]>
branch nick: 3.0
timestamp: Sat 2007-06-23 08:38:45 -0400
message:
  Simplify doctests by having just a single test_documentation.py module in
  Mailman/testing.  This introspects the Mailman/docs directory and adds
  DocFileSuites for all .txt files found there.
removed:
  Mailman/testing/test_acknowledge.py
  Mailman/testing/test_address.py
  Mailman/testing/test_after_delivery.py
  Mailman/testing/test_avoid_duplicates.py
  Mailman/testing/test_calc_recips.py
  Mailman/testing/test_cleanse.py
  Mailman/testing/test_cook_headers.py
  Mailman/testing/test_decorate.py
  Mailman/testing/test_listmanager.py
  Mailman/testing/test_mlist_addresses.py
  Mailman/testing/test_replybot.py
  Mailman/testing/test_user.py
  Mailman/testing/test_usermanager.py
added:
  Mailman/testing/test_documentation.py
modified:
  Mailman/testing/base.py
  Mailman/testing/test_membership.py

=== removed file 'Mailman/testing/test_acknowledge.py'
--- a/Mailman/testing/test_acknowledge.py       2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_acknowledge.py       1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing message acknowledgment."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/acknowledge.txt'))
-    return suite

=== removed file 'Mailman/testing/test_address.py'
--- a/Mailman/testing/test_address.py   2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_address.py   1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing IAddress interface."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/addresses.txt'))
-    return suite

=== removed file 'Mailman/testing/test_after_delivery.py'
--- a/Mailman/testing/test_after_delivery.py    2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_after_delivery.py    1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing bookkeeping done after message delivery."""
-
-import unittest
-
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/after-delivery.txt'))
-    return suite

=== removed file 'Mailman/testing/test_avoid_duplicates.py'
--- a/Mailman/testing/test_avoid_duplicates.py  2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_avoid_duplicates.py  1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for the AvoidDuplicates handler."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/avoid-duplicates.txt'))
-    return suite

=== removed file 'Mailman/testing/test_calc_recips.py'
--- a/Mailman/testing/test_calc_recips.py       2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_calc_recips.py       1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing the recipient calculation handler."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/calc-recips.txt'))
-    return suite

=== removed file 'Mailman/testing/test_cleanse.py'
--- a/Mailman/testing/test_cleanse.py   2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_cleanse.py   1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for the Cleanse handler."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/cleanse.txt'))
-    return suite

=== removed file 'Mailman/testing/test_cook_headers.py'
--- a/Mailman/testing/test_cook_headers.py      2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_cook_headers.py      1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for the CookHeaders handler."""
-
-import os
-import unittest
-
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    for filename in ('ack-headers', 'cook-headers', 'subject-munging',
-                     'reply-to'):
-        path = os.path.join('..', 'docs', filename + '.txt')
-        suite.addTest(make_docfile_suite(path))
-    return suite

=== removed file 'Mailman/testing/test_decorate.py'
--- a/Mailman/testing/test_decorate.py  2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_decorate.py  1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing message decoration."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/decorate.txt'))
-    return suite

=== removed file 'Mailman/testing/test_listmanager.py'
--- a/Mailman/testing/test_listmanager.py       2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_listmanager.py       1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing mailing list creation and deletion."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/listmanager.txt'))
-    return suite

=== removed file 'Mailman/testing/test_mlist_addresses.py'
--- a/Mailman/testing/test_mlist_addresses.py   2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_mlist_addresses.py   1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for the IMailingListAddresses interface."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/mlist-addresses.txt'))
-    return suite

=== removed file 'Mailman/testing/test_replybot.py'
--- a/Mailman/testing/test_replybot.py  2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_replybot.py  1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing the replybot handler."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/replybot.txt'))
-    return suite

=== removed file 'Mailman/testing/test_user.py'
--- a/Mailman/testing/test_user.py      2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_user.py      1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing users."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/users.txt'))
-    return suite

=== removed file 'Mailman/testing/test_usermanager.py'
--- a/Mailman/testing/test_usermanager.py       2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_usermanager.py       1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-# Copyright (C) 2007 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-# USA.
-
-"""Doctest harness for testing mailing list creation and deletion."""
-
-import unittest
-from Mailman.testing.base import make_docfile_suite
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/usermanager.txt'))
-    return suite

=== added file 'Mailman/testing/test_documentation.py'
--- a/Mailman/testing/test_documentation.py     1970-01-01 00:00:00 +0000
+++ b/Mailman/testing/test_documentation.py     2007-06-23 12:38:45 +0000
@@ -0,0 +1,68 @@
+# Copyright (C) 2007 by the Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+"""Harness for testing Mailman's documentation."""
+
+import os
+import doctest
+import unittest
+
+import Mailman
+from Mailman.configuration import config
+from Mailman.database import flush
+
+
+COMMASPACE = ', '
+
+
+
+def cleaning_teardown(testobj):
+    for user in config.user_manager.users:
+        config.user_manager.delete_user(user)
+    for address in config.user_manager.addresses:
+        config.user_manager.delete_address(address)
+    for mlist in config.list_manager.mailing_lists:
+        for member in mlist.members.members:
+            member.unsubscribe()
+        for admin in mlist.administrators.members:
+            admin.unsubscribe()
+        config.list_manager.delete(mlist)
+    flush()
+    assert not list(config.list_manager.mailing_lists), (
+        'There should be no mailing lists left: %s' %
+        COMMASPACE.join(sorted(config.list_manager.names)))
+    assert not list(config.user_manager.users), (
+        'There should be no users left!')
+    assert not list(config.user_manager.addresses), (
+        'There should be no addresses left!')
+
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    docsdir = os.path.join(os.path.dirname(Mailman.__file__), 'docs')
+    for filename in os.listdir(docsdir):
+        if os.path.splitext(filename)[1] == '.txt':
+            test = doctest.DocFileSuite(
+                'docs/' + filename,
+                package=Mailman,
+                optionflags=(doctest.ELLIPSIS
+                             | doctest.NORMALIZE_WHITESPACE
+                             | doctest.REPORT_NDIFF),
+                tearDown=cleaning_teardown)
+            suite.addTest(test)
+    return suite

=== modified file 'Mailman/testing/base.py'
--- a/Mailman/testing/base.py   2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/base.py   2007-06-23 12:38:45 +0000
@@ -24,7 +24,6 @@
 import sys
 import stat
 import shutil
-import doctest
 import difflib
 import tempfile
 import unittest
@@ -36,11 +35,9 @@
 from Mailman import Utils
 from Mailman.bin import rmlist
 from Mailman.configuration import config
-from Mailman.database import flush
 from Mailman.database.dbcontext import dbcontext
 
 NL = '\n'
-COMMASPACE = ', '
 
 
 
@@ -82,34 +79,3 @@
                 path = os.path.join(config.LOCK_DIR, filename)
                 print >> sys.stderr, '@@@@@ removing:', path
                 os.unlink(path)
-
-
-
-def cleaning_teardown(testobj):
-    for user in config.user_manager.users:
-        config.user_manager.delete_user(user)
-    for address in config.user_manager.addresses:
-        config.user_manager.delete_address(address)
-    for mlist in config.list_manager.mailing_lists:
-        for member in mlist.members.members:
-            member.unsubscribe()
-        for admin in mlist.administrators.members:
-            admin.unsubscribe()
-        config.list_manager.delete(mlist)
-    flush()
-    assert not list(config.list_manager.mailing_lists), (
-        'There should be no mailing lists left: %s' %
-        COMMASPACE.join(sorted(config.list_manager.names)))
-    assert not list(config.user_manager.users), (
-        'There should be no users left!')
-    assert not list(config.user_manager.addresses), (
-        'There should be no addresses left!')
-
-
-def make_docfile_suite(path):
-    return doctest.DocFileSuite(
-        path,
-        optionflags=(doctest.ELLIPSIS
-                     | doctest.NORMALIZE_WHITESPACE
-                     | doctest.REPORT_NDIFF),
-        tearDown=cleaning_teardown)

=== modified file 'Mailman/testing/test_membership.py'
--- a/Mailman/testing/test_membership.py        2007-06-22 21:15:03 +0000
+++ b/Mailman/testing/test_membership.py        2007-06-23 12:38:45 +0000
@@ -28,7 +28,7 @@
 from Mailman.Errors import NotAMemberError
 from Mailman.UserDesc import UserDesc
 from Mailman.configuration import config
-from Mailman.testing.base import TestBase, make_docfile_suite
+from Mailman.testing.base import TestBase
 
 
 
@@ -387,5 +387,4 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(make_docfile_suite('../docs/membership.txt'))
     return suite



--
(no title)
https://code.launchpad.net/~mailman-coders/mailman/3.0

You are receiving this branch notification because you are subscribed to it.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/3.0/+subscription/mailman-checkins.
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to