Hi Arnaud,

On Jun 07, 2011, at 11:55 AM, arnaud.le-...@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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Mailman-Developers mailing list
Mailman-Developers@python.org
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to