diff options
| author | Barry Warsaw | 2011-04-01 18:51:29 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-04-01 18:51:29 -0400 |
| commit | 33ad44bc97f08df71f227f6f2a006e770a75c353 (patch) | |
| tree | ef369d5dc968372d824cbe50421a1f5331461149 /src/mailman/testing/__init__.py | |
| parent | dee26f391da59c68a23f8fb960dff9ebd879e916 (diff) | |
| download | mailman-33ad44bc97f08df71f227f6f2a006e770a75c353.tar.gz mailman-33ad44bc97f08df71f227f6f2a006e770a75c353.tar.zst mailman-33ad44bc97f08df71f227f6f2a006e770a75c353.zip | |
* Re-organize the interface between buildout.cfg and the zope.testing layer
initialization. buildout.cfg is now really simple; it calls one method.
That method does all the relevant layer initializations. This better
localizes what has to be set up before testing can even begin.
* IUsers now have a created_on property which contains the datetime at which
the user record was created.
* Rework the date and uid factories so that they consult the
MockAndMonkeyLayer for the current testing flag. Also, those factories
register themselves with the layer so that they'll get automatically reset
between tests, without the layer actually having to know about them.
* Move the User model object initialization into User.__init__() from the user
manager. The User now also adds itself to the store.
* Add a 'uid factory' for unique id creation, which is test suite aware.
Diffstat (limited to 'src/mailman/testing/__init__.py')
| -rw-r--r-- | src/mailman/testing/__init__.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mailman/testing/__init__.py b/src/mailman/testing/__init__.py index e69de29bb..84182e1f1 100644 --- a/src/mailman/testing/__init__.py +++ b/src/mailman/testing/__init__.py @@ -0,0 +1,39 @@ +# Copyright (C) 2011 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman 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 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman 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 +# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. + +"""Set up testing. + +This is used as an interface to buildout.cfg's [test] section. +zope.testrunner supports an initialization variable. It is set to import and +run the following test initialization method. +""" + +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'initialize', + ] + + + +def initialize(root_directory): + """Initialize the test infrastructure.""" + from mailman.testing import layers + layers.MockAndMonkeyLayer.testing_mode = True + layers.ConfigLayer.enable_stderr(); + layers.ConfigLayer.set_root_directory(root_directory) |
