summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/Handlers/Decorate.py2
-rw-r--r--Mailman/Makefile.in3
-rw-r--r--Mailman/SafeDict.py2
-rw-r--r--Mailman/bin/testall.py151
-rw-r--r--Mailman/testing/Makefile.in81
-rw-r--r--Mailman/testing/__init__.py0
-rw-r--r--Mailman/testing/base.py (renamed from tests/TestBase.py)32
-rw-r--r--Mailman/testing/bounces/Makefile.in (renamed from tests/bounces/Makefile.in)11
-rw-r--r--Mailman/testing/bounces/bounce_01.txt (renamed from tests/bounces/bounce_01.txt)0
-rw-r--r--Mailman/testing/bounces/bounce_02.txt (renamed from tests/bounces/bounce_02.txt)0
-rw-r--r--Mailman/testing/bounces/bounce_03.txt (renamed from tests/bounces/bounce_03.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_01.txt (renamed from tests/bounces/dsn_01.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_02.txt (renamed from tests/bounces/dsn_02.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_03.txt (renamed from tests/bounces/dsn_03.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_04.txt (renamed from tests/bounces/dsn_04.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_05.txt (renamed from tests/bounces/dsn_05.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_06.txt (renamed from tests/bounces/dsn_06.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_07.txt (renamed from tests/bounces/dsn_07.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_08.txt (renamed from tests/bounces/dsn_08.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_09.txt (renamed from tests/bounces/dsn_09.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_10.txt (renamed from tests/bounces/dsn_10.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_11.txt (renamed from tests/bounces/dsn_11.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_12.txt (renamed from tests/bounces/dsn_12.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_13.txt (renamed from tests/bounces/dsn_13.txt)0
-rw-r--r--Mailman/testing/bounces/dsn_14.txt (renamed from tests/bounces/dsn_14.txt)0
-rw-r--r--Mailman/testing/bounces/dumbass_01.txt (renamed from tests/bounces/dumbass_01.txt)0
-rw-r--r--Mailman/testing/bounces/exim_01.txt (renamed from tests/bounces/exim_01.txt)0
-rw-r--r--Mailman/testing/bounces/groupwise_01.txt (renamed from tests/bounces/groupwise_01.txt)0
-rw-r--r--Mailman/testing/bounces/groupwise_02.txt (renamed from tests/bounces/groupwise_02.txt)0
-rw-r--r--Mailman/testing/bounces/hotpop_01.txt (renamed from tests/bounces/hotpop_01.txt)0
-rw-r--r--Mailman/testing/bounces/llnl_01.txt (renamed from tests/bounces/llnl_01.txt)0
-rw-r--r--Mailman/testing/bounces/microsoft_01.txt (renamed from tests/bounces/microsoft_01.txt)0
-rw-r--r--Mailman/testing/bounces/microsoft_02.txt (renamed from tests/bounces/microsoft_02.txt)0
-rw-r--r--Mailman/testing/bounces/microsoft_03.txt (renamed from tests/bounces/microsoft_03.txt)0
-rw-r--r--Mailman/testing/bounces/netscape_01.txt (renamed from tests/bounces/netscape_01.txt)0
-rw-r--r--Mailman/testing/bounces/newmailru_01.txt (renamed from tests/bounces/newmailru_01.txt)0
-rw-r--r--Mailman/testing/bounces/postfix_01.txt (renamed from tests/bounces/postfix_01.txt)0
-rw-r--r--Mailman/testing/bounces/postfix_02.txt (renamed from tests/bounces/postfix_02.txt)0
-rw-r--r--Mailman/testing/bounces/postfix_03.txt (renamed from tests/bounces/postfix_03.txt)0
-rw-r--r--Mailman/testing/bounces/postfix_04.txt (renamed from tests/bounces/postfix_04.txt)0
-rw-r--r--Mailman/testing/bounces/postfix_05.txt (renamed from tests/bounces/postfix_05.txt)0
-rw-r--r--Mailman/testing/bounces/qmail_01.txt (renamed from tests/bounces/qmail_01.txt)0
-rw-r--r--Mailman/testing/bounces/qmail_02.txt (renamed from tests/bounces/qmail_02.txt)0
-rw-r--r--Mailman/testing/bounces/qmail_03.txt (renamed from tests/bounces/qmail_03.txt)0
-rw-r--r--Mailman/testing/bounces/qmail_04.txt (renamed from tests/bounces/qmail_04.txt)0
-rw-r--r--Mailman/testing/bounces/sendmail_01.txt (renamed from tests/bounces/sendmail_01.txt)0
-rw-r--r--Mailman/testing/bounces/simple_01.txt (renamed from tests/bounces/simple_01.txt)0
-rw-r--r--Mailman/testing/bounces/simple_02.txt (renamed from tests/bounces/simple_02.txt)0
-rw-r--r--Mailman/testing/bounces/simple_03.txt (renamed from tests/bounces/simple_03.txt)0
-rw-r--r--Mailman/testing/bounces/simple_04.txt (renamed from tests/bounces/simple_04.txt)0
-rw-r--r--Mailman/testing/bounces/simple_05.txt (renamed from tests/bounces/simple_05.txt)0
-rw-r--r--Mailman/testing/bounces/simple_06.txt (renamed from tests/bounces/simple_06.txt)0
-rw-r--r--Mailman/testing/bounces/simple_07.txt (renamed from tests/bounces/simple_07.txt)0
-rw-r--r--Mailman/testing/bounces/simple_08.txt (renamed from tests/bounces/simple_08.txt)0
-rw-r--r--Mailman/testing/bounces/simple_09.txt (renamed from tests/bounces/simple_09.txt)0
-rw-r--r--Mailman/testing/bounces/simple_10.txt (renamed from tests/bounces/simple_10.txt)0
-rw-r--r--Mailman/testing/bounces/simple_11.txt (renamed from tests/bounces/simple_11.txt)0
-rw-r--r--Mailman/testing/bounces/simple_12.txt (renamed from tests/bounces/simple_12.txt)0
-rw-r--r--Mailman/testing/bounces/simple_13.txt (renamed from tests/bounces/simple_13.txt)0
-rw-r--r--Mailman/testing/bounces/simple_14.txt (renamed from tests/bounces/simple_14.txt)0
-rw-r--r--Mailman/testing/bounces/simple_15.txt (renamed from tests/bounces/simple_15.txt)0
-rw-r--r--Mailman/testing/bounces/simple_16.txt (renamed from tests/bounces/simple_16.txt)0
-rw-r--r--Mailman/testing/bounces/simple_17.txt (renamed from tests/bounces/simple_17.txt)0
-rw-r--r--Mailman/testing/bounces/sina_01.txt (renamed from tests/bounces/sina_01.txt)0
-rw-r--r--Mailman/testing/bounces/smtp32_01.txt (renamed from tests/bounces/smtp32_01.txt)0
-rw-r--r--Mailman/testing/bounces/smtp32_02.txt (renamed from tests/bounces/smtp32_02.txt)0
-rw-r--r--Mailman/testing/bounces/smtp32_03.txt (renamed from tests/bounces/smtp32_03.txt)0
-rw-r--r--Mailman/testing/bounces/smtp32_04.txt (renamed from tests/bounces/smtp32_04.txt)0
-rw-r--r--Mailman/testing/bounces/smtp32_05.txt (renamed from tests/bounces/smtp32_05.txt)0
-rw-r--r--Mailman/testing/bounces/smtp32_06.txt (renamed from tests/bounces/smtp32_06.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_01.txt (renamed from tests/bounces/yahoo_01.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_02.txt (renamed from tests/bounces/yahoo_02.txt)bin2212 -> 2212 bytes
-rw-r--r--Mailman/testing/bounces/yahoo_03.txt (renamed from tests/bounces/yahoo_03.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_04.txt (renamed from tests/bounces/yahoo_04.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_05.txt (renamed from tests/bounces/yahoo_05.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_06.txt (renamed from tests/bounces/yahoo_06.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_07.txt (renamed from tests/bounces/yahoo_07.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_08.txt (renamed from tests/bounces/yahoo_08.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_09.txt (renamed from tests/bounces/yahoo_09.txt)0
-rw-r--r--Mailman/testing/bounces/yahoo_10.txt (renamed from tests/bounces/yahoo_10.txt)0
-rw-r--r--Mailman/testing/bounces/yale_01.txt (renamed from tests/bounces/yale_01.txt)0
-rw-r--r--Mailman/testing/emailbase.py (renamed from tests/EmailBase.py)22
-rw-r--r--Mailman/testing/test_bounces.py (renamed from tests/test_bounces.py)11
-rw-r--r--Mailman/testing/test_handlers.py (renamed from tests/test_handlers.py)39
-rw-r--r--Mailman/testing/test_lockfile.py (renamed from tests/test_lockfile.py)36
-rw-r--r--Mailman/testing/test_membership.py (renamed from tests/test_membership.py)37
-rw-r--r--Mailman/testing/test_message.py (renamed from tests/test_message.py)32
-rw-r--r--Mailman/testing/test_runners.py (renamed from tests/test_runners.py)26
-rw-r--r--Mailman/testing/test_safedict.py (renamed from tests/test_safedict.py)21
-rw-r--r--Mailman/testing/test_security_mgr.py (renamed from tests/test_security_mgr.py)37
-rw-r--r--Makefile.in2
-rw-r--r--bin/Makefile.in2
-rwxr-xr-xconfigure7
-rw-r--r--configure.in5
-rw-r--r--tests/Makefile.in5
-rw-r--r--tests/testall.py40
96 files changed, 389 insertions, 215 deletions
diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py
index 2e1d11bf0..df4e36b1b 100644
--- a/Mailman/Handlers/Decorate.py
+++ b/Mailman/Handlers/Decorate.py
@@ -121,7 +121,7 @@ def process(mlist, msg, msgdata):
# The next easiest thing to do is just prepend the header and append
# the footer as additional subparts
payload = msg.get_payload()
- if not isinstance(payload, ListType):
+ if not isinstance(payload, list):
payload = [payload]
if footer:
mimeftr = MIMEText(footer, 'plain', lcset)
diff --git a/Mailman/Makefile.in b/Mailman/Makefile.in
index 2fe6c0d14..5caf04719 100644
--- a/Mailman/Makefile.in
+++ b/Mailman/Makefile.in
@@ -43,7 +43,8 @@ PACKAGEDIR= $(prefix)/Mailman
SHELL= /bin/sh
MODULES= $(srcdir)/*.py
-SUBDIRS= Cgi Archiver Handlers Bouncers Queue MTA Gui Commands bin
+SUBDIRS= Cgi Archiver Handlers Bouncers Queue MTA Gui Commands \
+ bin testing
# Modes for directories and executables created by the install
# process. Default to group-writable directories but
diff --git a/Mailman/SafeDict.py b/Mailman/SafeDict.py
index 92f6b238e..29817467c 100644
--- a/Mailman/SafeDict.py
+++ b/Mailman/SafeDict.py
@@ -19,6 +19,8 @@
COMMASPACE = ', '
+# XXX This module should go away.
+
class SafeDict(dict):
diff --git a/Mailman/bin/testall.py b/Mailman/bin/testall.py
new file mode 100644
index 000000000..dae46b7ff
--- /dev/null
+++ b/Mailman/bin/testall.py
@@ -0,0 +1,151 @@
+# Copyright (C) 2001-2006 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.
+
+"""Mailman unit test driver."""
+
+import os
+import re
+import sys
+import optparse
+import unittest
+
+from Mailman import loginit
+from Mailman import mm_cfg
+from Mailman.i18n import _
+
+__i18n_templates__ = True
+
+
+
+def v_callback(option, opt, value, parser):
+ if opt in ('-q', '--quiet'):
+ delta = -1
+ elif opt in ('-v', '--verbose'):
+ delta = 1
+ else:
+ delta = 0
+ dest = getattr(parser.values, option.dest)
+ setattr(parser.values, option.dest, max(0, dest + delta))
+
+
+def parseargs():
+ parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ usage=_("""\
+%prog [options] [tests]
+
+Run the Mailman unit test suite. 'tests' is one or more Python regular
+expressions matching only the tests you want to run. Prefix the regular
+expression with '!' to specify a negative test."""))
+ parser.set_defaults(verbosity=2)
+ parser.add_option('-v', '--verbose',
+ action='callback', callback=v_callback,
+ dest='verbosity', help=_("""\
+Increase verbosity by 1, which defaults to %default. Use -q to reduce
+verbosity. -v and -q options accumulate."""))
+ parser.add_option('-q', '--quiet',
+ action='callback', callback=v_callback,
+ dest='verbosity', help=_("""\
+Reduce verbosity by 1 (but not below 0)."""))
+ parser.add_option('-e', '--stderr',
+ default=False, action='store_true',
+ help=_('Propagate log errors to stderr.'))
+ opts, args = parser.parse_args()
+ return parser, opts, args
+
+
+
+def search():
+ testnames = []
+ # Walk the entire tree from the current base directory. Look for modules
+ # that start with 'test_'. Calculate the full module path name to this
+ # module, append 'test_suite' and add that to testnames. This way, we run
+ # all the suites defined in the test_suite() function inside all test
+ # modules.
+ for dirpath, dirnames, filenames in os.walk(basedir):
+ for fn in filenames:
+ if fn.startswith('test_') and fn.endswith('.py'):
+ # Start with full path
+ path = os.path.join(dirpath, fn)
+ # Convert the file path to a module path. First, we must make
+ # the file path relative to the root directory. Then strip
+ # off the trailing .py
+ path = path[len(basedir)+1:-3]
+ # Convert slashes to dots
+ modpath = path.replace(os.sep, '.') + '.test_suite'
+ testnames.append('Mailman.' + modpath)
+ return testnames
+
+
+def match(pat, name):
+ if not pat:
+ return True
+ if pat.startswith('!'):
+ # Negative test
+ return re.search(pat[1:], name) is None
+ else:
+ # Positive test
+ return re.search(pat, name) is not None
+
+
+def filter_tests(suite, patterns):
+ if '.' in patterns:
+ return suite
+ new = unittest.TestSuite()
+ for test in suite._tests:
+ if isinstance(test, unittest.TestCase):
+ # Get the fill test name: package.module.class.method
+ name = test.id()
+ for pat in patterns:
+ if match(pat, name):
+ new.addTest(test)
+ break
+ else:
+ filtered = filter_tests(test, patterns)
+ if filtered:
+ new.addTest(filtered)
+ return new
+
+
+def suite(patterns=None):
+ if patterns is None:
+ patterns = '.'
+ loader = unittest.TestLoader()
+ # Search for all tests that match the given patterns
+ testnames = search()
+ suite = loader.loadTestsFromNames(testnames)
+ return filter_tests(suite, patterns)
+
+
+
+def main():
+ global basedir
+
+ parser, opts, args = parseargs()
+ if not args:
+ args = ['.']
+ loginit.initialize(propagate=opts.stderr)
+
+ import Mailman
+ basedir = os.path.dirname(Mailman.__file__)
+ runner = unittest.TextTestRunner(verbosity=opts.verbosity)
+ results = runner.run(suite(args))
+ sys.exit(bool(results.failures or results.errors))
+
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Mailman/testing/Makefile.in b/Mailman/testing/Makefile.in
new file mode 100644
index 000000000..07ae80213
--- /dev/null
+++ b/Mailman/testing/Makefile.in
@@ -0,0 +1,81 @@
+# Copyright (C) 1998-2006 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.
+
+# NOTE: Makefile.in is converted into Makefile by the configure script
+# in the parent directory. Once configure has run, you can recreate
+# the Makefile by running just config.status.
+
+# Variables set by configure
+
+VPATH= @srcdir@
+srcdir= @srcdir@
+bindir= @bindir@
+prefix= @prefix@
+exec_prefix= @exec_prefix@
+DESTDIR=
+
+CC= @CC@
+CHMOD= @CHMOD@
+INSTALL= @INSTALL@
+
+DEFS= @DEFS@
+
+# Customizable but not set by configure
+
+OPT= @OPT@
+CFLAGS= $(OPT) $(DEFS)
+PACKAGEDIR= $(prefix)/Mailman/testing
+SHELL= /bin/sh
+
+MODULES= *.py
+
+# Modes for directories and executables created by the install
+# process. Default to group-writable directories but
+# user-only-writable for executables.
+DIRMODE= 775
+EXEMODE= 755
+FILEMODE= 644
+INSTALL_PROGRAM=$(INSTALL) -m $(EXEMODE)
+
+# Directories make should decend into
+SUBDIRS= bounces
+
+# Rules
+
+all:
+
+install:
+ for f in $(MODULES); \
+ do \
+ $(INSTALL) -m $(FILEMODE) $(srcdir)/$$f $(DESTDIR)$(PACKAGEDIR); \
+ done
+ for d in $(SUBDIRS); \
+ do \
+ (cd $$d; $(MAKE) DESTDIR=$(DESTDIR) install); \
+ done
+
+finish:
+
+clean:
+
+distclean:
+ -rm *.pyc
+ -rm Makefile
+ @for d in $(SUBDIRS); \
+ do \
+ (cd $$d; $(MAKE) distclean); \
+ done
diff --git a/Mailman/testing/__init__.py b/Mailman/testing/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Mailman/testing/__init__.py
diff --git a/tests/TestBase.py b/Mailman/testing/base.py
index 2381f4cab..83a8044d3 100644
--- a/tests/TestBase.py
+++ b/Mailman/testing/base.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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
@@ -12,15 +12,16 @@
#
# 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.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Test base class which handles creating and deleting a test list.
-"""
+"""Test base class which handles creating and deleting a test list."""
import os
import shutil
import difflib
import unittest
+
from cStringIO import StringIO
from Mailman import MailList
@@ -32,20 +33,15 @@ NL = '\n'
class TestBase(unittest.TestCase):
- if hasattr(difflib, 'ndiff'):
- # Python 2.2 and beyond
- def ndiffAssertEqual(self, first, second):
- """Like failUnlessEqual except use ndiff for readable output."""
- if first <> second:
- sfirst = str(first)
- ssecond = str(second)
- diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
- fp = StringIO()
- print >> fp, NL, NL.join(diff)
- raise self.failureException, fp.getvalue()
- else:
- # Python 2.1
- ndiffAssertEqual = unittest.TestCase.assertEqual
+ def ndiffAssertEqual(self, first, second):
+ """Like failUnlessEqual except use ndiff for readable output."""
+ if first <> second:
+ sfirst = str(first)
+ ssecond = str(second)
+ diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
+ fp = StringIO()
+ print >> fp, NL, NL.join(diff)
+ raise self.failureException(fp.getvalue())
def setUp(self):
mlist = MailList.MailList()
diff --git a/tests/bounces/Makefile.in b/Mailman/testing/bounces/Makefile.in
index 579809755..116a723e4 100644
--- a/tests/bounces/Makefile.in
+++ b/Mailman/testing/bounces/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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
@@ -12,11 +12,8 @@
#
# You should have received a copy of the GNU General Public Licenseo
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# NOTE: Makefile.in is converted into Makefile by the configure script
-# in the parent directory. Once configure has run, you can recreate
-# the Makefile by running just config.status.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
# Variables set by configure
@@ -37,7 +34,7 @@ DEFS= @DEFS@
OPT= @OPT@
CFLAGS= $(OPT) $(DEFS)
-BOUNCEDIR= $(prefix)/tests/bounces
+BOUNCEDIR= $(prefix)/Mailman/testing/bounces
SHELL= /bin/sh
BOUNCE_FILES= $(srcdir)/*.txt
diff --git a/tests/bounces/bounce_01.txt b/Mailman/testing/bounces/bounce_01.txt
index ab7f45d47..ab7f45d47 100644
--- a/tests/bounces/bounce_01.txt
+++ b/Mailman/testing/bounces/bounce_01.txt
diff --git a/tests/bounces/bounce_02.txt b/Mailman/testing/bounces/bounce_02.txt
index 0f7d7f32d..0f7d7f32d 100644
--- a/tests/bounces/bounce_02.txt
+++ b/Mailman/testing/bounces/bounce_02.txt
diff --git a/tests/bounces/bounce_03.txt b/Mailman/testing/bounces/bounce_03.txt
index fc62dcab6..fc62dcab6 100644
--- a/tests/bounces/bounce_03.txt
+++ b/Mailman/testing/bounces/bounce_03.txt
diff --git a/tests/bounces/dsn_01.txt b/Mailman/testing/bounces/dsn_01.txt
index d09768c6a..d09768c6a 100644
--- a/tests/bounces/dsn_01.txt
+++ b/Mailman/testing/bounces/dsn_01.txt
diff --git a/tests/bounces/dsn_02.txt b/Mailman/testing/bounces/dsn_02.txt
index 3525605f8..3525605f8 100644
--- a/tests/bounces/dsn_02.txt
+++ b/Mailman/testing/bounces/dsn_02.txt
diff --git a/tests/bounces/dsn_03.txt b/Mailman/testing/bounces/dsn_03.txt
index 4e4fef058..4e4fef058 100644
--- a/tests/bounces/dsn_03.txt
+++ b/Mailman/testing/bounces/dsn_03.txt
diff --git a/tests/bounces/dsn_04.txt b/Mailman/testing/bounces/dsn_04.txt
index 9bea97589..9bea97589 100644
--- a/tests/bounces/dsn_04.txt
+++ b/Mailman/testing/bounces/dsn_04.txt
diff --git a/tests/bounces/dsn_05.txt b/Mailman/testing/bounces/dsn_05.txt
index 73331578e..73331578e 100644
--- a/tests/bounces/dsn_05.txt
+++ b/Mailman/testing/bounces/dsn_05.txt
diff --git a/tests/bounces/dsn_06.txt b/Mailman/testing/bounces/dsn_06.txt
index 22f69760a..22f69760a 100644
--- a/tests/bounces/dsn_06.txt
+++ b/Mailman/testing/bounces/dsn_06.txt
diff --git a/tests/bounces/dsn_07.txt b/Mailman/testing/bounces/dsn_07.txt
index 2e5a0e5d8..2e5a0e5d8 100644
--- a/tests/bounces/dsn_07.txt
+++ b/Mailman/testing/bounces/dsn_07.txt
diff --git a/tests/bounces/dsn_08.txt b/Mailman/testing/bounces/dsn_08.txt
index 8d4d3b8b6..8d4d3b8b6 100644
--- a/tests/bounces/dsn_08.txt
+++ b/Mailman/testing/bounces/dsn_08.txt
diff --git a/tests/bounces/dsn_09.txt b/Mailman/testing/bounces/dsn_09.txt
index 89c0f9add..89c0f9add 100644
--- a/tests/bounces/dsn_09.txt
+++ b/Mailman/testing/bounces/dsn_09.txt
diff --git a/tests/bounces/dsn_10.txt b/Mailman/testing/bounces/dsn_10.txt
index d37aa1745..d37aa1745 100644
--- a/tests/bounces/dsn_10.txt
+++ b/Mailman/testing/bounces/dsn_10.txt
diff --git a/tests/bounces/dsn_11.txt b/Mailman/testing/bounces/dsn_11.txt
index f3e8acaa7..f3e8acaa7 100644
--- a/tests/bounces/dsn_11.txt
+++ b/Mailman/testing/bounces/dsn_11.txt
diff --git a/tests/bounces/dsn_12.txt b/Mailman/testing/bounces/dsn_12.txt
index 473abb8b2..473abb8b2 100644
--- a/tests/bounces/dsn_12.txt
+++ b/Mailman/testing/bounces/dsn_12.txt
diff --git a/tests/bounces/dsn_13.txt b/Mailman/testing/bounces/dsn_13.txt
index c9156f3af..c9156f3af 100644
--- a/tests/bounces/dsn_13.txt
+++ b/Mailman/testing/bounces/dsn_13.txt
diff --git a/tests/bounces/dsn_14.txt b/Mailman/testing/bounces/dsn_14.txt
index 448b4e042..448b4e042 100644
--- a/tests/bounces/dsn_14.txt
+++ b/Mailman/testing/bounces/dsn_14.txt
diff --git a/tests/bounces/dumbass_01.txt b/Mailman/testing/bounces/dumbass_01.txt
index c4e40d4b0..c4e40d4b0 100644
--- a/tests/bounces/dumbass_01.txt
+++ b/Mailman/testing/bounces/dumbass_01.txt
diff --git a/tests/bounces/exim_01.txt b/Mailman/testing/bounces/exim_01.txt
index 42ceb0b0a..42ceb0b0a 100644
--- a/tests/bounces/exim_01.txt
+++ b/Mailman/testing/bounces/exim_01.txt
diff --git a/tests/bounces/groupwise_01.txt b/Mailman/testing/bounces/groupwise_01.txt
index 68101ba07..68101ba07 100644
--- a/tests/bounces/groupwise_01.txt
+++ b/Mailman/testing/bounces/groupwise_01.txt
diff --git a/tests/bounces/groupwise_02.txt b/Mailman/testing/bounces/groupwise_02.txt
index 3abfdf869..3abfdf869 100644
--- a/tests/bounces/groupwise_02.txt
+++ b/Mailman/testing/bounces/groupwise_02.txt
diff --git a/tests/bounces/hotpop_01.txt b/Mailman/testing/bounces/hotpop_01.txt
index 970c39985..970c39985 100644
--- a/tests/bounces/hotpop_01.txt
+++ b/Mailman/testing/bounces/hotpop_01.txt
diff --git a/tests/bounces/llnl_01.txt b/Mailman/testing/bounces/llnl_01.txt
index 9a6de7f9a..9a6de7f9a 100644
--- a/tests/bounces/llnl_01.txt
+++ b/Mailman/testing/bounces/llnl_01.txt
diff --git a/tests/bounces/microsoft_01.txt b/Mailman/testing/bounces/microsoft_01.txt
index 92465f78b..92465f78b 100644
--- a/tests/bounces/microsoft_01.txt
+++ b/Mailman/testing/bounces/microsoft_01.txt
diff --git a/tests/bounces/microsoft_02.txt b/Mailman/testing/bounces/microsoft_02.txt
index 3c6c5416d..3c6c5416d 100644
--- a/tests/bounces/microsoft_02.txt
+++ b/Mailman/testing/bounces/microsoft_02.txt
diff --git a/tests/bounces/microsoft_03.txt b/Mailman/testing/bounces/microsoft_03.txt
index e4216e0c9..e4216e0c9 100644
--- a/tests/bounces/microsoft_03.txt
+++ b/Mailman/testing/bounces/microsoft_03.txt
diff --git a/tests/bounces/netscape_01.txt b/Mailman/testing/bounces/netscape_01.txt
index adcde15b9..adcde15b9 100644
--- a/tests/bounces/netscape_01.txt
+++ b/Mailman/testing/bounces/netscape_01.txt
diff --git a/tests/bounces/newmailru_01.txt b/Mailman/testing/bounces/newmailru_01.txt
index 7802c1516..7802c1516 100644
--- a/tests/bounces/newmailru_01.txt
+++ b/Mailman/testing/bounces/newmailru_01.txt
diff --git a/tests/bounces/postfix_01.txt b/Mailman/testing/bounces/postfix_01.txt
index 186cc7633..186cc7633 100644
--- a/tests/bounces/postfix_01.txt
+++ b/Mailman/testing/bounces/postfix_01.txt
diff --git a/tests/bounces/postfix_02.txt b/Mailman/testing/bounces/postfix_02.txt
index c4065816e..c4065816e 100644
--- a/tests/bounces/postfix_02.txt
+++ b/Mailman/testing/bounces/postfix_02.txt
diff --git a/tests/bounces/postfix_03.txt b/Mailman/testing/bounces/postfix_03.txt
index 5204712c4..5204712c4 100644
--- a/tests/bounces/postfix_03.txt
+++ b/Mailman/testing/bounces/postfix_03.txt
diff --git a/tests/bounces/postfix_04.txt b/Mailman/testing/bounces/postfix_04.txt
index 86a60ea8d..86a60ea8d 100644
--- a/tests/bounces/postfix_04.txt
+++ b/Mailman/testing/bounces/postfix_04.txt
diff --git a/tests/bounces/postfix_05.txt b/Mailman/testing/bounces/postfix_05.txt
index 4bd56d60a..4bd56d60a 100644
--- a/tests/bounces/postfix_05.txt
+++ b/Mailman/testing/bounces/postfix_05.txt
diff --git a/tests/bounces/qmail_01.txt b/Mailman/testing/bounces/qmail_01.txt
index dbe6f4351..dbe6f4351 100644
--- a/tests/bounces/qmail_01.txt
+++ b/Mailman/testing/bounces/qmail_01.txt
diff --git a/tests/bounces/qmail_02.txt b/Mailman/testing/bounces/qmail_02.txt
index ad3a232f1..ad3a232f1 100644
--- a/tests/bounces/qmail_02.txt
+++ b/Mailman/testing/bounces/qmail_02.txt
diff --git a/tests/bounces/qmail_03.txt b/Mailman/testing/bounces/qmail_03.txt
index 04e352806..04e352806 100644
--- a/tests/bounces/qmail_03.txt
+++ b/Mailman/testing/bounces/qmail_03.txt
diff --git a/tests/bounces/qmail_04.txt b/Mailman/testing/bounces/qmail_04.txt
index dae2db011..dae2db011 100644
--- a/tests/bounces/qmail_04.txt
+++ b/Mailman/testing/bounces/qmail_04.txt
diff --git a/tests/bounces/sendmail_01.txt b/Mailman/testing/bounces/sendmail_01.txt
index cfea95a2f..cfea95a2f 100644
--- a/tests/bounces/sendmail_01.txt
+++ b/Mailman/testing/bounces/sendmail_01.txt
diff --git a/tests/bounces/simple_01.txt b/Mailman/testing/bounces/simple_01.txt
index f2d2669f6..f2d2669f6 100644
--- a/tests/bounces/simple_01.txt
+++ b/Mailman/testing/bounces/simple_01.txt
diff --git a/tests/bounces/simple_02.txt b/Mailman/testing/bounces/simple_02.txt
index f017fa25d..f017fa25d 100644
--- a/tests/bounces/simple_02.txt
+++ b/Mailman/testing/bounces/simple_02.txt
diff --git a/tests/bounces/simple_03.txt b/Mailman/testing/bounces/simple_03.txt
index 16fc04d63..16fc04d63 100644
--- a/tests/bounces/simple_03.txt
+++ b/Mailman/testing/bounces/simple_03.txt
diff --git a/tests/bounces/simple_04.txt b/Mailman/testing/bounces/simple_04.txt
index 022a31980..022a31980 100644
--- a/tests/bounces/simple_04.txt
+++ b/Mailman/testing/bounces/simple_04.txt
diff --git a/tests/bounces/simple_05.txt b/Mailman/testing/bounces/simple_05.txt
index c67113b40..c67113b40 100644
--- a/tests/bounces/simple_05.txt
+++ b/Mailman/testing/bounces/simple_05.txt
diff --git a/tests/bounces/simple_06.txt b/Mailman/testing/bounces/simple_06.txt
index bbb2b7573..bbb2b7573 100644
--- a/tests/bounces/simple_06.txt
+++ b/Mailman/testing/bounces/simple_06.txt
diff --git a/tests/bounces/simple_07.txt b/Mailman/testing/bounces/simple_07.txt
index 46930ec4a..46930ec4a 100644
--- a/tests/bounces/simple_07.txt
+++ b/Mailman/testing/bounces/simple_07.txt
diff --git a/tests/bounces/simple_08.txt b/Mailman/testing/bounces/simple_08.txt
index c2067ce53..c2067ce53 100644
--- a/tests/bounces/simple_08.txt
+++ b/Mailman/testing/bounces/simple_08.txt
diff --git a/tests/bounces/simple_09.txt b/Mailman/testing/bounces/simple_09.txt
index 340c410b7..340c410b7 100644
--- a/tests/bounces/simple_09.txt
+++ b/Mailman/testing/bounces/simple_09.txt
diff --git a/tests/bounces/simple_10.txt b/Mailman/testing/bounces/simple_10.txt
index dfc9c3cf0..dfc9c3cf0 100644
--- a/tests/bounces/simple_10.txt
+++ b/Mailman/testing/bounces/simple_10.txt
diff --git a/tests/bounces/simple_11.txt b/Mailman/testing/bounces/simple_11.txt
index 2d046db5c..2d046db5c 100644
--- a/tests/bounces/simple_11.txt
+++ b/Mailman/testing/bounces/simple_11.txt
diff --git a/tests/bounces/simple_12.txt b/Mailman/testing/bounces/simple_12.txt
index b2146d46d..b2146d46d 100644
--- a/tests/bounces/simple_12.txt
+++ b/Mailman/testing/bounces/simple_12.txt
diff --git a/tests/bounces/simple_13.txt b/Mailman/testing/bounces/simple_13.txt
index 1cbe0f955..1cbe0f955 100644
--- a/tests/bounces/simple_13.txt
+++ b/Mailman/testing/bounces/simple_13.txt
diff --git a/tests/bounces/simple_14.txt b/Mailman/testing/bounces/simple_14.txt
index caffd77b7..caffd77b7 100644
--- a/tests/bounces/simple_14.txt
+++ b/Mailman/testing/bounces/simple_14.txt
diff --git a/tests/bounces/simple_15.txt b/Mailman/testing/bounces/simple_15.txt
index 522096a72..522096a72 100644
--- a/tests/bounces/simple_15.txt
+++ b/Mailman/testing/bounces/simple_15.txt
diff --git a/tests/bounces/simple_16.txt b/Mailman/testing/bounces/simple_16.txt
index 4ab1f1bee..4ab1f1bee 100644
--- a/tests/bounces/simple_16.txt
+++ b/Mailman/testing/bounces/simple_16.txt
diff --git a/tests/bounces/simple_17.txt b/Mailman/testing/bounces/simple_17.txt
index 10c8aac5a..10c8aac5a 100644
--- a/tests/bounces/simple_17.txt
+++ b/Mailman/testing/bounces/simple_17.txt
diff --git a/tests/bounces/sina_01.txt b/Mailman/testing/bounces/sina_01.txt
index 366500a94..366500a94 100644
--- a/tests/bounces/sina_01.txt
+++ b/Mailman/testing/bounces/sina_01.txt
diff --git a/tests/bounces/smtp32_01.txt b/Mailman/testing/bounces/smtp32_01.txt
index decf0ddcc..decf0ddcc 100644
--- a/tests/bounces/smtp32_01.txt
+++ b/Mailman/testing/bounces/smtp32_01.txt
diff --git a/tests/bounces/smtp32_02.txt b/Mailman/testing/bounces/smtp32_02.txt
index 3336a28d4..3336a28d4 100644
--- a/tests/bounces/smtp32_02.txt
+++ b/Mailman/testing/bounces/smtp32_02.txt
diff --git a/tests/bounces/smtp32_03.txt b/Mailman/testing/bounces/smtp32_03.txt
index 0c284afcb..0c284afcb 100644
--- a/tests/bounces/smtp32_03.txt
+++ b/Mailman/testing/bounces/smtp32_03.txt
diff --git a/tests/bounces/smtp32_04.txt b/Mailman/testing/bounces/smtp32_04.txt
index 813d956a0..813d956a0 100644
--- a/tests/bounces/smtp32_04.txt
+++ b/Mailman/testing/bounces/smtp32_04.txt
diff --git a/tests/bounces/smtp32_05.txt b/Mailman/testing/bounces/smtp32_05.txt
index 92997ace2..92997ace2 100644
--- a/tests/bounces/smtp32_05.txt
+++ b/Mailman/testing/bounces/smtp32_05.txt
diff --git a/tests/bounces/smtp32_06.txt b/Mailman/testing/bounces/smtp32_06.txt
index ec7cc9522..ec7cc9522 100644
--- a/tests/bounces/smtp32_06.txt
+++ b/Mailman/testing/bounces/smtp32_06.txt
diff --git a/tests/bounces/yahoo_01.txt b/Mailman/testing/bounces/yahoo_01.txt
index 0758957f3..0758957f3 100644
--- a/tests/bounces/yahoo_01.txt
+++ b/Mailman/testing/bounces/yahoo_01.txt
diff --git a/tests/bounces/yahoo_02.txt b/Mailman/testing/bounces/yahoo_02.txt
index 90d835dc9..90d835dc9 100644
--- a/tests/bounces/yahoo_02.txt
+++ b/Mailman/testing/bounces/yahoo_02.txt
Binary files differ
diff --git a/tests/bounces/yahoo_03.txt b/Mailman/testing/bounces/yahoo_03.txt
index 9de32a43b..9de32a43b 100644
--- a/tests/bounces/yahoo_03.txt
+++ b/Mailman/testing/bounces/yahoo_03.txt
diff --git a/tests/bounces/yahoo_04.txt b/Mailman/testing/bounces/yahoo_04.txt
index cf6036360..cf6036360 100644
--- a/tests/bounces/yahoo_04.txt
+++ b/Mailman/testing/bounces/yahoo_04.txt
diff --git a/tests/bounces/yahoo_05.txt b/Mailman/testing/bounces/yahoo_05.txt
index 56d1a3018..56d1a3018 100644
--- a/tests/bounces/yahoo_05.txt
+++ b/Mailman/testing/bounces/yahoo_05.txt
diff --git a/tests/bounces/yahoo_06.txt b/Mailman/testing/bounces/yahoo_06.txt
index 16c04fd65..16c04fd65 100644
--- a/tests/bounces/yahoo_06.txt
+++ b/Mailman/testing/bounces/yahoo_06.txt
diff --git a/tests/bounces/yahoo_07.txt b/Mailman/testing/bounces/yahoo_07.txt
index 1f35e70f0..1f35e70f0 100644
--- a/tests/bounces/yahoo_07.txt
+++ b/Mailman/testing/bounces/yahoo_07.txt
diff --git a/tests/bounces/yahoo_08.txt b/Mailman/testing/bounces/yahoo_08.txt
index c531cef9b..c531cef9b 100644
--- a/tests/bounces/yahoo_08.txt
+++ b/Mailman/testing/bounces/yahoo_08.txt
diff --git a/tests/bounces/yahoo_09.txt b/Mailman/testing/bounces/yahoo_09.txt
index f8067a5b4..f8067a5b4 100644
--- a/tests/bounces/yahoo_09.txt
+++ b/Mailman/testing/bounces/yahoo_09.txt
diff --git a/tests/bounces/yahoo_10.txt b/Mailman/testing/bounces/yahoo_10.txt
index 958b90924..958b90924 100644
--- a/tests/bounces/yahoo_10.txt
+++ b/Mailman/testing/bounces/yahoo_10.txt
diff --git a/tests/bounces/yale_01.txt b/Mailman/testing/bounces/yale_01.txt
index 7be4754eb..7be4754eb 100644
--- a/tests/bounces/yale_01.txt
+++ b/Mailman/testing/bounces/yale_01.txt
diff --git a/tests/EmailBase.py b/Mailman/testing/emailbase.py
index d83ccbcf4..115ea6839 100644
--- a/tests/EmailBase.py
+++ b/Mailman/testing/emailbase.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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
@@ -12,18 +12,18 @@
#
# 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.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Base class for tests that email things.
-"""
+"""Base class for tests that email things."""
+import smtpd
import socket
import asyncore
-import smtpd
+import subprocess
from Mailman import mm_cfg
-
-from TestBase import TestBase
+from Mailman.testing.base import TestBase
@@ -49,9 +49,11 @@ class SinkServer(smtpd.SMTPServer):
class EmailBase(TestBase):
def setUp(self):
TestBase.setUp(self)
- # Second argument tuple is ignored.
- self._server = SinkServer(('localhost', mm_cfg.SMTPPORT),
- ('localhost', 25))
+ # Find an unused non-root requiring port to listen on
+ oldport = mm_cfg.SMTPPORT
+ mm_cfg.SMTPPORT = port = 10825
+ # Second argument is ignored.
+ self._server = SinkServer(('localhost', port), None)
def tearDown(self):
self._server.close()
diff --git a/tests/test_bounces.py b/Mailman/testing/test_bounces.py
index 1cc386125..8756701e2 100644
--- a/tests/test_bounces.py
+++ b/Mailman/testing/test_bounces.py
@@ -17,10 +17,10 @@
"""Test the bounce detection modules."""
-import sys
import os
-import unittest
+import sys
import email
+import unittest
from Mailman.Bouncers.BouncerAPI import Stop
@@ -203,12 +203,7 @@ Content-Type: multipart/report; boundary=BOUNDARY
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(BounceTest))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/tests/test_handlers.py b/Mailman/testing/test_handlers.py
index 3d86bfaff..056fde1c0 100644
--- a/tests/test_handlers.py
+++ b/Mailman/testing/test_handlers.py
@@ -30,9 +30,9 @@ from email.Generator import Generator
from Mailman import Errors
from Mailman import Message
from Mailman import mm_cfg
-from Mailman import Pending
from Mailman.MailList import MailList
from Mailman.Queue.Switchboard import Switchboard
+from Mailman.testing.base import TestBase
from Mailman.Handlers import Acknowledge
from Mailman.Handlers import AfterDelivery
@@ -54,8 +54,6 @@ from Mailman.Handlers import ToDigest
from Mailman.Handlers import ToOutgoing
from Mailman.Handlers import ToUsenet
-from TestBase import TestBase
-
def password(plaintext):
@@ -708,7 +706,7 @@ From: aperson@dom.ain
""", Message.Message)
CookHeaders.process(self._mlist, msg, {})
- eq(msg['list-id'].__unicode__(), 'A Test List <_xtest.dom.ain>')
+ eq(unicode(msg['list-id']), u'A Test List <_xtest.dom.ain>')
eq(msg['list-help'], '<mailto:_xtest-request@dom.ain?subject=help>')
eq(msg['list-unsubscribe'],
'<http://www.dom.ain/mailman/listinfo/_xtest>,'
@@ -1113,8 +1111,8 @@ From: aperson@dom.ain
confirmlines = pmsg.get_payload().split('\n')
cookie = confirmlines[-3].split('/')[-1]
# We also need to make sure there's an entry in the Pending database
- # for the heold message.
- data = Pending.confirm(cookie)
+ # for the hold message.
+ data = self._mlist.pend_confirm(cookie)
eq(data, ('H', 1))
heldmsg = os.path.join(mm_cfg.DATA_DIR, 'heldmsg-_xtest-1.pck')
self.failUnless(os.path.exists(heldmsg))
@@ -1204,9 +1202,12 @@ yyy
eq(subpart.get_payload(), 'yyy')
def test_convert_to_plaintext(self):
- # BAW: This test is dependent on your particular lynx version
eq = self.assertEqual
- msg = email.message_from_string("""\
+ # XXX Skip this test if the html->text converter program is not
+ # available.
+ program = mm_cfg.HTML_TO_PLAIN_TEXT_COMMAND.split()[0]
+ if os.path.isfile(program):
+ msg = email.message_from_string("""\
From: aperson@dom.ain
Content-Type: text/html
MIME-Version: 1.0
@@ -1214,9 +1215,9 @@ MIME-Version: 1.0
<html><head></head>
<body></body></html>
""")
- MimeDel.process(self._mlist, msg, {})
- eq(msg.get_type(), 'text/plain')
- eq(msg.get_payload(), '\n\n\n')
+ MimeDel.process(self._mlist, msg, {})
+ eq(msg.get_type(), 'text/plain')
+ eq(msg.get_payload(), '\n\n\n')
def test_deep_structure(self):
eq = self.assertEqual
@@ -1498,7 +1499,7 @@ It rocks!
files = self._sb.files()
eq(len(files), 1)
msg2, data = self._sb.dequeue(files[0])
- eq(len(data), 2)
+ eq(len(data), 3)
eq(data['version'], 3)
# Clock skew makes this unreliable
#self.failUnless(data['received_time'] <= time.time())
@@ -1591,8 +1592,13 @@ class TestToOutgoing(TestBase):
TestBase.setUp(self)
# We're going to want to inspect this queue directory
self._sb = Switchboard(mm_cfg.OUTQUEUE_DIR)
+ # Save and set this value
+ self._interval = mm_cfg.VERP_DELIVERY_INTERVAL
+ mm_cfg.VERP_DELIVERY_INTERVAL = 1
def tearDown(self):
+ # Restore this value
+ mm_cfg.VERP_DELIVERY_INTERVAL = self._interval
for f in os.listdir(mm_cfg.OUTQUEUE_DIR):
os.unlink(os.path.join(mm_cfg.OUTQUEUE_DIR, f))
TestBase.tearDown(self)
@@ -1610,7 +1616,7 @@ It rocks!
eq(len(files), 1)
msg2, data = self._sb.dequeue(files[0])
eq(msg.as_string(unixfrom=0), msg2.as_string(unixfrom=0))
- eq(len(data), 6)
+ eq(len(data), 7)
eq(data['foo'], 1)
eq(data['bar'], 2)
eq(data['version'], 3)
@@ -1669,7 +1675,7 @@ Mailman rocks!
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestAcknowledge))
suite.addTest(unittest.makeSuite(TestAfterDelivery))
@@ -1690,8 +1696,3 @@ def suite():
suite.addTest(unittest.makeSuite(TestToOutgoing))
suite.addTest(unittest.makeSuite(TestToUsenet))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/tests/test_lockfile.py b/Mailman/testing/test_lockfile.py
index 832e745f9..465a925cd 100644
--- a/tests/test_lockfile.py
+++ b/Mailman/testing/test_lockfile.py
@@ -1,31 +1,44 @@
-# Copyright (C) 2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2002-2006 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.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Unit tests for the LockFile class.
-"""
+"""Unit tests for the LockFile class."""
+import os
+import shutil
+import tempfile
import unittest
from Mailman.LockFile import LockFile
-LOCKFILE_NAME = '/tmp/.mm-test-lock'
+LOCKFILE_NAME = '.mm-test-lock'
class TestLockFile(unittest.TestCase):
+ def setUp(self):
+ self._tmpdir = tempfile.mkdtemp(prefix='mmtest')
+ self._lockf = os.path.join(self._tmpdir, LOCKFILE_NAME)
+
+ def tearDown(self):
+ shutil.rmtree(self._tmpdir)
+
+ # XXX There really should be additional multi-thread or -proc tests, a la
+ # the __main__ of LockFile.py
+
def test_two_lockfiles_same_proc(self):
lf1 = LockFile(LOCKFILE_NAME)
lf2 = LockFile(LOCKFILE_NAME)
@@ -34,12 +47,7 @@ class TestLockFile(unittest.TestCase):
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestLockFile))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/tests/test_membership.py b/Mailman/testing/test_membership.py
index 8ffda18b8..d6f4343d2 100644
--- a/tests/test_membership.py
+++ b/Mailman/testing/test_membership.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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
@@ -12,23 +12,22 @@
#
# 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.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Unit tests for OldStyleMemberships.
-"""
+"""Unit tests for OldStyleMemberships."""
import os
import time
import unittest
-from Mailman import mm_cfg
-from Mailman import Utils
from Mailman import MailList
from Mailman import MemberAdaptor
+from Mailman import Utils
+from Mailman import mm_cfg
from Mailman.Errors import NotAMemberError
from Mailman.UserDesc import UserDesc
-
-from TestBase import TestBase
+from Mailman.testing.base import TestBase
@@ -195,9 +194,18 @@ class TestMembers(TestBase):
self.failIf(mlist.authenticateMember('person@dom.ain', 'xxXXxx'))
def test_set_language(self):
- self._mlist.available_languages.append('xx')
- self._mlist.setMemberLanguage('person@dom.ain', 'xx')
- self.assertEqual(self._mlist.getMemberLanguage('person@dom.ain'), 'xx')
+ # This test requires that the 'xx' language be in the global
+ # mm_cfg.LC_DESCRIPTIONS. Save that value and be sure to restore it
+ # after the test is done.
+ odesc = mm_cfg.LC_DESCRIPTIONS.copy()
+ try:
+ mm_cfg.add_language('xx', 'Xxian', 'utf-8')
+ self._mlist.available_languages.append('xx')
+ self._mlist.setMemberLanguage('person@dom.ain', 'xx')
+ self.assertEqual(self._mlist.getMemberLanguage('person@dom.ain'),
+ 'xx')
+ finally:
+ mm_cfg.LC_DESCRIPTIONS = odesc
def test_basic_option(self):
eq = self.assertEqual
@@ -369,13 +377,8 @@ class TestMembers(TestBase):
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestNoMembers))
suite.addTest(unittest.makeSuite(TestMembers))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/tests/test_message.py b/Mailman/testing/test_message.py
index da6f8a087..93e0525e9 100644
--- a/tests/test_message.py
+++ b/Mailman/testing/test_message.py
@@ -1,30 +1,29 @@
-# Copyright (C) 2001 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Unit tests for the various Message class methods.
-"""
+"""Unit tests for the various Message class methods."""
-import unittest
import email
+import unittest
+from Mailman import Errors
from Mailman import Message
from Mailman import Version
-from Mailman import Errors
-
-from EmailBase import EmailBase
+from Mailman.testing.emailbase import EmailBase
@@ -55,11 +54,11 @@ class TestSentMessage(EmailBase):
eq(qmsg['list-post'], '<mailto:_xtest@dom.ain>')
eq(qmsg['list-subscribe'], """\
<http://www.dom.ain/mailman/listinfo/_xtest>,
- <mailto:_xtest-request@dom.ain?subject=subscribe>""")
+ <mailto:_xtest-request@dom.ain?subject=subscribe>""")
eq(qmsg['list-id'], '<_xtest.dom.ain>')
eq(qmsg['list-unsubscribe'], """\
<http://www.dom.ain/mailman/listinfo/_xtest>,
- <mailto:_xtest-request@dom.ain?subject=unsubscribe>""")
+ <mailto:_xtest-request@dom.ain?subject=unsubscribe>""")
eq(qmsg['list-archive'], '<http://www.dom.ain/pipermail/_xtest>')
eq(qmsg.get_payload(), 'About your test list')
@@ -91,12 +90,7 @@ yadda yadda yadda
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSentMessage))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/tests/test_runners.py b/Mailman/testing/test_runners.py
index c0baf02ba..82938c206 100644
--- a/tests/test_runners.py
+++ b/Mailman/testing/test_runners.py
@@ -1,28 +1,27 @@
-# Copyright (C) 2001 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Unit tests for the various Mailman/Queue/*Runner.py modules
-"""
+"""Unit tests for the various Mailman qrunner modules."""
-import unittest
import email
+import unittest
from Mailman.Queue.NewsRunner import prepare_message
-
-from TestBase import TestBase
+from Mailman.testing.base import TestBase
@@ -109,12 +108,7 @@ A message
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPrepMessage))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/tests/test_safedict.py b/Mailman/testing/test_safedict.py
index 27d6adb3b..8b73fd2dc 100644
--- a/tests/test_safedict.py
+++ b/Mailman/testing/test_safedict.py
@@ -1,21 +1,21 @@
-# Copyright (C) 2001 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Unit tests for the SafeDict.py module
-"""
+"""Unit tests for the SafeDict module."""
import email
import unittest
@@ -91,13 +91,8 @@ Cc: bperson@dom.ain
])
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSafeDict))
suite.addTest(unittest.makeSuite(TestMsgSafeDict))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/tests/test_security_mgr.py b/Mailman/testing/test_security_mgr.py
index c63f0876b..700167358 100644
--- a/tests/test_security_mgr.py
+++ b/Mailman/testing/test_security_mgr.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2006 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
@@ -12,29 +12,30 @@
#
# 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.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
-"""Unit tests for Mailman/SecurityManager.py
-"""
+"""Unit tests for the SecurityManager module"""
import os
-import unittest
-import errno
import md5
import sha
+import errno
import Cookie
+import unittest
+
try:
import crypt
except ImportError:
crypt = None
+
# Don't use cStringIO because we're going to inherit
from StringIO import StringIO
-from Mailman import mm_cfg
-from Mailman import Utils
from Mailman import Errors
-
-from TestBase import TestBase
+from Mailman import Utils
+from Mailman import mm_cfg
+from Mailman.testing.base import TestBase
@@ -171,14 +172,15 @@ class TestAuthenticate(TestBase):
def test_wrong_user(self):
mlist = self._mlist
mlist.addNewMember('aperson@dom.ain', password='nosrepa')
- self.assertRaises(Errors.NotAMemberError, mlist.Authenticate,
- [mm_cfg.AuthUser], 'nosrepa', 'bperson@dom.ain')
+ self.assertEqual(
+ mlist.Authenticate([mm_cfg.AuthUser], 'nosrepa', 'bperson@dom.ain'),
+ mm_cfg.UnAuthorized)
def test_no_user(self):
mlist = self._mlist
mlist.addNewMember('aperson@dom.ain', password='nosrepa')
- self.assertRaises(AttributeError, mlist.Authenticate,
- [mm_cfg.AuthUser], 'nosrepa')
+ self.assertEqual(mlist.Authenticate([mm_cfg.AuthUser], 'norespa'),
+ mm_cfg.UnAuthorized)
def test_user_unauth(self):
mlist = self._mlist
@@ -260,14 +262,9 @@ class TestWebAuthenticate(TestBase):
-def suite():
+def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSecurityManager))
suite.addTest(unittest.makeSuite(TestAuthenticate))
suite.addTest(unittest.makeSuite(TestWebAuthenticate))
return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')
diff --git a/Makefile.in b/Makefile.in
index e14df27db..aa49d9310 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -52,7 +52,7 @@ ARCH_INDEP_DIRS= \
Mailman Mailman/bin Mailman/Cgi Mailman/Archiver \
Mailman/Handlers Mailman/Queue Mailman/Bouncers \
Mailman/MTA Mailman/Gui Mailman/Commands messages icons \
- tests tests/bounces tests/msgs
+ Mailman/testing Mailman/testing/bounces tests tests/msgs
ARCH_DEP_DIRS= cgi-bin mail
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 67ceef621..f5233b18c 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -55,7 +55,7 @@ SCRIPTS= mmshell \
LN_SCRIPTS= add_members arch change_pw find_member inject list_lists \
list_members list_owners mmsitepass newlist rmlist \
- show_qfiles unshunt version
+ show_qfiles testall unshunt version
BUILDDIR= ../build/bin
diff --git a/configure b/configure
index 4378ddfd4..aae990544 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 7895 .
+# From configure.in Revision: 7897 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for GNU Mailman 2.2.0a0.
#
@@ -4319,7 +4319,7 @@ build/contrib/rotatelogs.py:contrib/rotatelogs.py \
# scripts. They're removed on a make distclean, so we make them here.
mkdir -p build/bin build/contrib build/cron
- ac_config_files="$ac_config_files misc/paths.py Mailman/Defaults.py Mailman/mm_cfg.py.dist src/Makefile misc/Makefile bin/Makefile Mailman/bin/Makefile Mailman/Makefile Mailman/Cgi/Makefile Mailman/Archiver/Makefile Mailman/Commands/Makefile Mailman/Handlers/Makefile Mailman/Bouncers/Makefile Mailman/Queue/Makefile Mailman/MTA/Makefile Mailman/Gui/Makefile templates/Makefile cron/Makefile scripts/Makefile messages/Makefile cron/crontab.in misc/mailman Makefile tests/Makefile tests/bounces/Makefile tests/msgs/Makefile $SCRIPTS"
+ ac_config_files="$ac_config_files misc/paths.py Mailman/Defaults.py Mailman/mm_cfg.py.dist src/Makefile misc/Makefile bin/Makefile Mailman/bin/Makefile Mailman/Makefile Mailman/Cgi/Makefile Mailman/Archiver/Makefile Mailman/Commands/Makefile Mailman/Handlers/Makefile Mailman/Bouncers/Makefile Mailman/Queue/Makefile Mailman/MTA/Makefile Mailman/Gui/Makefile templates/Makefile cron/Makefile scripts/Makefile messages/Makefile cron/crontab.in misc/mailman Makefile Mailman/testing/Makefile Mailman/testing/bounces/Makefile tests/Makefile tests/msgs/Makefile $SCRIPTS"
ac_config_commands="$ac_config_commands default"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4898,8 +4898,9 @@ do
"cron/crontab.in" ) CONFIG_FILES="$CONFIG_FILES cron/crontab.in" ;;
"misc/mailman" ) CONFIG_FILES="$CONFIG_FILES misc/mailman" ;;
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "Mailman/testing/Makefile" ) CONFIG_FILES="$CONFIG_FILES Mailman/testing/Makefile" ;;
+ "Mailman/testing/bounces/Makefile" ) CONFIG_FILES="$CONFIG_FILES Mailman/testing/bounces/Makefile" ;;
"tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
- "tests/bounces/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/bounces/Makefile" ;;
"tests/msgs/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/msgs/Makefile" ;;
"$SCRIPTS" ) CONFIG_FILES="$CONFIG_FILES $SCRIPTS" ;;
"default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
diff --git a/configure.in b/configure.in
index e50a3ad6e..3cd34d5aa 100644
--- a/configure.in
+++ b/configure.in
@@ -15,7 +15,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 7897 $)
+AC_REVISION($Revision: 7899 $)
AC_PREREQ(2.0)
AC_INIT([GNU Mailman], [2.2.0a0])
@@ -648,7 +648,8 @@ AC_OUTPUT([misc/paths.py Mailman/Defaults.py Mailman/mm_cfg.py.dist
Mailman/Queue/Makefile Mailman/MTA/Makefile Mailman/Gui/Makefile
templates/Makefile cron/Makefile scripts/Makefile messages/Makefile
cron/crontab.in misc/mailman Makefile
- tests/Makefile tests/bounces/Makefile tests/msgs/Makefile
+ Mailman/testing/Makefile Mailman/testing/bounces/Makefile
+ tests/Makefile tests/msgs/Makefile
$SCRIPTS],
echo "configuration completed at" `date`)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 26d6e3166..a8b2aff60 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -40,7 +40,6 @@ CFLAGS= $(OPT) $(DEFS)
TESTDIR= $(prefix)/tests
SHELL= /bin/sh
-TEST_MODULES= $(srcdir)/test*.py $(srcdir)/*Base.py
EXECS= $(srcdir)/onebounce.py $(srcdir)/fblast.py
# Modes for directories and executables created by the install
@@ -58,10 +57,6 @@ SUBDIRS= bounces msgs
all:
install:
- for f in $(TEST_MODULES); \
- do \
- $(INSTALL) -m $(FILEMODE) $$f $(DESTDIR)$(TESTDIR); \
- done
for f in $(EXECS); \
do \
$(INSTALL) -m $(EXEMODE) $$f $(DESTDIR)$(TESTDIR); \
diff --git a/tests/testall.py b/tests/testall.py
deleted file mode 100644
index 1afbfe5d3..000000000
--- a/tests/testall.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2001-2003 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.
-
-"""PyUnit-based test harness for Mailman."""
-
-import unittest
-
-MODULES = ('bounces', 'handlers', 'membership', 'safedict',
- 'security_mgr', 'runners', 'lockfile', 'smtp',
- )
-
-# test_message.py can only be run when mailmanctl is running, but mailmanctl
-# can't be run when the other tests are run, 'cause it'll clobber qfiles.
-# This means you have to run test_message.py manually. :(
-
-
-def suite():
- alltests = unittest.TestSuite()
- for modname in MODULES:
- mod = __import__('test_'+modname)
- alltests.addTest(mod.suite())
- return alltests
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='suite')