summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw2007-06-23 08:38:45 -0400
committerBarry Warsaw2007-06-23 08:38:45 -0400
commit55b97d69b0c08e66215a673f3cd92ab7d260c714 (patch)
treef1d49e923ed5612b01600f03fc3ac70656be8818
parentfb690ba3605dcaceaa7d39e5de22d44e93d61dd4 (diff)
downloadmailman-55b97d69b0c08e66215a673f3cd92ab7d260c714.tar.gz
mailman-55b97d69b0c08e66215a673f3cd92ab7d260c714.tar.zst
mailman-55b97d69b0c08e66215a673f3cd92ab7d260c714.zip
-rw-r--r--Mailman/testing/base.py34
-rw-r--r--Mailman/testing/test_acknowledge.py27
-rw-r--r--Mailman/testing/test_address.py27
-rw-r--r--Mailman/testing/test_after_delivery.py28
-rw-r--r--Mailman/testing/test_avoid_duplicates.py27
-rw-r--r--Mailman/testing/test_calc_recips.py27
-rw-r--r--Mailman/testing/test_cleanse.py27
-rw-r--r--Mailman/testing/test_cook_headers.py32
-rw-r--r--Mailman/testing/test_decorate.py27
-rw-r--r--Mailman/testing/test_documentation.py68
-rw-r--r--Mailman/testing/test_listmanager.py27
-rw-r--r--Mailman/testing/test_membership.py3
-rw-r--r--Mailman/testing/test_mlist_addresses.py27
-rw-r--r--Mailman/testing/test_replybot.py27
-rw-r--r--Mailman/testing/test_user.py27
-rw-r--r--Mailman/testing/test_usermanager.py27
16 files changed, 69 insertions, 393 deletions
diff --git a/Mailman/testing/base.py b/Mailman/testing/base.py
index c3f64554a..562443b1e 100644
--- a/Mailman/testing/base.py
+++ b/Mailman/testing/base.py
@@ -24,7 +24,6 @@ import pwd
import sys
import stat
import shutil
-import doctest
import difflib
import tempfile
import unittest
@@ -36,11 +35,9 @@ from Mailman import MailList
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 @@ class TestBase(unittest.TestCase):
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)
diff --git a/Mailman/testing/test_acknowledge.py b/Mailman/testing/test_acknowledge.py
deleted file mode 100644
index 605c6edda..000000000
--- a/Mailman/testing/test_acknowledge.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_address.py b/Mailman/testing/test_address.py
deleted file mode 100644
index d66292c55..000000000
--- a/Mailman/testing/test_address.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_after_delivery.py b/Mailman/testing/test_after_delivery.py
deleted file mode 100644
index a7d0f01f4..000000000
--- a/Mailman/testing/test_after_delivery.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_avoid_duplicates.py b/Mailman/testing/test_avoid_duplicates.py
deleted file mode 100644
index b5de721e6..000000000
--- a/Mailman/testing/test_avoid_duplicates.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_calc_recips.py b/Mailman/testing/test_calc_recips.py
deleted file mode 100644
index da3929b65..000000000
--- a/Mailman/testing/test_calc_recips.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_cleanse.py b/Mailman/testing/test_cleanse.py
deleted file mode 100644
index e058c7bfa..000000000
--- a/Mailman/testing/test_cleanse.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_cook_headers.py b/Mailman/testing/test_cook_headers.py
deleted file mode 100644
index dd141aab9..000000000
--- a/Mailman/testing/test_cook_headers.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_decorate.py b/Mailman/testing/test_decorate.py
deleted file mode 100644
index 1bbe84250..000000000
--- a/Mailman/testing/test_decorate.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_documentation.py b/Mailman/testing/test_documentation.py
new file mode 100644
index 000000000..99c2ffbae
--- /dev/null
+++ b/Mailman/testing/test_documentation.py
@@ -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
diff --git a/Mailman/testing/test_listmanager.py b/Mailman/testing/test_listmanager.py
deleted file mode 100644
index e6e9d6a3b..000000000
--- a/Mailman/testing/test_listmanager.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_membership.py b/Mailman/testing/test_membership.py
index 810a2fed9..c6f854f0c 100644
--- a/Mailman/testing/test_membership.py
+++ b/Mailman/testing/test_membership.py
@@ -28,7 +28,7 @@ from Mailman import passwords
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 @@ class TestMembers(TestBase):
def test_suite():
suite = unittest.TestSuite()
- suite.addTest(make_docfile_suite('../docs/membership.txt'))
return suite
diff --git a/Mailman/testing/test_mlist_addresses.py b/Mailman/testing/test_mlist_addresses.py
deleted file mode 100644
index 1998f33ee..000000000
--- a/Mailman/testing/test_mlist_addresses.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_replybot.py b/Mailman/testing/test_replybot.py
deleted file mode 100644
index 9f5d454a6..000000000
--- a/Mailman/testing/test_replybot.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_user.py b/Mailman/testing/test_user.py
deleted file mode 100644
index b66efac62..000000000
--- a/Mailman/testing/test_user.py
+++ /dev/null
@@ -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
diff --git a/Mailman/testing/test_usermanager.py b/Mailman/testing/test_usermanager.py
deleted file mode 100644
index 9b98a6689..000000000
--- a/Mailman/testing/test_usermanager.py
+++ /dev/null
@@ -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