[Mailman-Developers] (no subject)

Barry Warsaw barry at list.org
Tue Jun 7 21:57:06 CEST 2011


Hi Arnaud,

On Jun 07, 2011, at 11:55 AM, arnaud.le-roy at voila.fr wrote:

>I've just installed mailman 3 : as my goal is to use it with the REST
>interface or custom scripts, I'd like to get a good grasp of how it is
>working. So, I'm trying to use it in interactive mode as in the package
>documentation. However, I'm not sure of the best way to be in the same
>context as in the documentation examples. At first I tried the "py" script
>under bin, but everything is not initialised (eg I have component not found
>errors for getUtility). Then I tried with mailman withlist. It works better
>now but I now see the dump_list function in the examples and I had to import
>it manually. So my question is : what is the context of the examples and how
>can I set it up ? Or are they all "ad hoc" with no general way to be in the
>same state ?

You're pretty close, actually.  The documentation does assume a slightly
crafted global namespace, which you can see in
src/mailman/tests/test_documentation.py.  Look in the setup() function.  I've
tried to keep these 'magic test gobals' to a minimum, but some are just too
darn convenient.

You're right that bin/py does not initialize the system.  That's exactly what
`bin/mailman withlist` does though.  As you've seen, you will have to manually
import certain names though, exactly the ones that test_documentation.py puts
in the doctest globals.  It should be fairly obvious from looking at that file
what you'll need and where to get it from.

The other tricky bit about the test suite is that you might need to take into
account the "layer" feature of zope.testing.  You'll find all the testing
layers in src/mailman/testing/layers.py and for doctests, some package
__init__.py files have a `layer` global that defines the layer for doctests in
that package.  See for example src/mailman/rest/docs/__init__.py.

I hope that helps.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/mailman-developers/attachments/20110607/773e331e/attachment.pgp>


More information about the Mailman-Developers mailing list