
On Sep 05, 2012, at 02:01 PM, Ethan Fremen wrote:
Is there any way to automatically generate lists/messages/members etc?
If not, how do you (existing devs) go about setting up mailman with said data?
I am interested in working on https://bugs.launchpad.net/postorius/+bug/1004049 , and so need to add some emails in "pending" state. More generally, having a bunch of lists/users/etc would be helpful in developing the UI further.
In general, I'm not a fan of sample data for tests. Back in my Launchpad days, we had tons of sample data that the tests relied on and we had a terrible experience with it. It makes tests brittle, difficult to understand the initial state, very difficult to change or update, etc. We were slowly weening ourselves off of sample data by the time I moved on to other projects.
The alternative is for the tests themselves to explicitly set up whatever minimal state they are testing, usually in their setUp() methods. They typically use the internal APIs (e.g. interfaces and a few other convenience functions) to set things up, including mailing lists, users, pending requests, emails in queues, etc. There's also a test helper that ensures all that state is cleaned up after each test, and this is hooked into the test layers (though eventually I'd like to get rid of zope.testing).
The mm3 does have a small amount of sample data, but only for the schema migration tests. Because the model can't be used to set up the test state, we basically create an unmigrated database and populate it from sample data, then run through the migrations, and test the results through the model. The model can't be used to set up the initial state because it already reflects the migrated schema and because it's Python code, it's not easy to change in the middle of a test.
I'm not sure how it's done in Postorius, but for the core, you can look through the substantial amounts of existing tests to see how things are done. There's probably a bit of "style skew" with the older tests doing things a bit out of what I now consider good style, but I've tried to spend some time getting the tests in a consistent state.
Hopefully that helps. -Barry