diff options
| author | Barry Warsaw | 2007-07-16 23:55:49 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2007-07-16 23:55:49 -0400 |
| commit | b8e8aa0386c2ee0fc7e90bf22fbe8fe3f222964a (patch) | |
| tree | 5893e3908f89d8dd988c7844827d83e60ab6c532 /Mailman/testing | |
| parent | 327865eaf118f40063366acad9c7d97487e010d6 (diff) | |
| download | mailman-b8e8aa0386c2ee0fc7e90bf22fbe8fe3f222964a.tar.gz mailman-b8e8aa0386c2ee0fc7e90bf22fbe8fe3f222964a.tar.zst mailman-b8e8aa0386c2ee0fc7e90bf22fbe8fe3f222964a.zip | |
Major surgery to get the setuptools based installation passing all the
existing unit tests. Here's a summary of the changes.
- Removed all dependent third party packages, since the setup.py file now
claims all package dependencies such that they can be automatically
installed from the cheeseshop.
- Moved the misc directory into the Mailman package as Mailman/data. Moved
templates and messages to Mailman subpackages.
- Added an ILanguageManager interface, plus an implementation, so that
we don't use Defaults.LC_DESCRIPTIONS directly anymore. Added a doctest
for this interface and implementation. Defaults.LANGUAGES is moved into
mailman.cfg. Defaults.LANGUAGE_DICT is moved to _DEFAULT_LANGUAGE_DATA, and
LC_DESCRIPTIONS is removed. The calculation of the available and enabled
languages is moved to the Configuration class, but this will probably still
need work. Utils.GetLanguageDescr() and Utils.IsLanguage() are removed.
I'd like to remove GetCharSet() eventually too, but there are too many uses
of this currently, so I'm deferring it.
- Utils.findtext(): Hacks added so that templates can be retrieved from the
language catalog. The hack is that the template contents are used to find
the translation, but in the one test case where this is actually flexed, the
trailing newline in the file contents has to be trimmed. This is probably
not right.
- No more Defaults.py.in or mm_cfg.py! Defaults.py.in is moved to Defaults.py
and is no longer created from a template file. The script called
make_instance is added which creates an etc/mailman.cfg file from
mailman.cfg.in (previously, mailman.cfg.sample) and /that/ file now has the
small number of calculated values. In general, make_instance will not touch
mailman.cfg if it exists, unless the --force option is given. CGIEXT is
made the empty string by default (i.e. not generated). make_instance grows
a --var-dir option. Fleshed out the --languages opton.
- Defaults.py grows a DEFAULT_VAR_DIRECTORY variable, which is the default
location of the 'var' directory. The Configuration class uses this as one
of the directories it searches for its landmark, i.e. etc/mailman.cfg.
RUNTIME_DIR is gone, as is VAR_PREFIX.
- testall needs to write MAILMAN_USER, MAILMAN_UID, MAILMAN_GROUP,
MAILMAN_GID, and LANGUAGES run time variables.
- bin/withlist no longer needs to add config.BIN_DIR to sys.path, because in
fact that variable doesn't exist any more.
- Tweak the French catalog to make a test work. This is needed because of the
conversion from %-strings to $-strings.
- The setup.py now generates the .mo files before it does its thing. This
will have to be fixed, but for now we must generate these files on setup
build time instead of installation time.
- Removed an unused interface.
Diffstat (limited to 'Mailman/testing')
| -rwxr-xr-x | Mailman/testing/bounces/__init__.py | 0 | ||||
| -rw-r--r-- | Mailman/testing/test_bounces.py | 22 | ||||
| -rw-r--r-- | Mailman/testing/testing.cfg.in | 2 |
3 files changed, 11 insertions, 13 deletions
diff --git a/Mailman/testing/bounces/__init__.py b/Mailman/testing/bounces/__init__.py new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/Mailman/testing/bounces/__init__.py diff --git a/Mailman/testing/test_bounces.py b/Mailman/testing/test_bounces.py index 54c82ff68..f09c671f4 100644 --- a/Mailman/testing/test_bounces.py +++ b/Mailman/testing/test_bounces.py @@ -17,14 +17,18 @@ """Test the bounce detection modules.""" +from __future__ import with_statement + import os import sys import email import unittest -from paths import prefix +import Mailman.testing.bounces from Mailman.Bouncers.BouncerAPI import Stop +MSGDIR = os.path.dirname(Mailman.testing.bounces.__file__) + class BounceTest(unittest.TestCase): @@ -157,15 +161,13 @@ class BounceTest(unittest.TestCase): ) def test_bounce(self): - for modname, file, addrs in self.DATA: + for modname, filename, addrs in self.DATA: module = 'Mailman.Bouncers.' + modname __import__(module) - fp = open(os.path.join(prefix, 'Mailman', 'testing', 'bounces', - file)) - try: + # XXX Convert this tousing package resources + path = os.path.join(MSGDIR, filename) + with open(path) as fp: msg = email.message_from_file(fp) - finally: - fp.close() foundaddrs = sys.modules[module].process(msg) # Some modules return None instead of [] for failure if foundaddrs is None: @@ -181,12 +183,8 @@ class BounceTest(unittest.TestCase): def test_SMTP32_failure(self): from Mailman.Bouncers import SMTP32 # This file has no X-Mailer: header - fp = open(os.path.join(prefix, 'Mailman', 'testing', 'bounces', - 'postfix_01.txt')) - try: + with open(os.path.join(MSGDIR, 'postfix_01.txt')) as fp: msg = email.message_from_file(fp) - finally: - fp.close() self.failIf(msg['x-mailer'] is not None) self.failIf(SMTP32.process(msg)) diff --git a/Mailman/testing/testing.cfg.in b/Mailman/testing/testing.cfg.in index 2609ef5cf..074806cb1 100644 --- a/Mailman/testing/testing.cfg.in +++ b/Mailman/testing/testing.cfg.in @@ -10,4 +10,4 @@ MTA = None add_domain('example.com', 'www.example.com') -# bin/testall will add a SQLALCHEMY_ENGINE_URL below +# bin/testall will add additional runtime configuration variables here. |
