The test suite is run with the tox tool, which allows it to be run against multiple versions of Python. There are two modes to the test suite:
- Record mode which is used to record the HTTP traffic against a live Mailman 3 REST server.
- Replay mode which allows you to run the test suite off-line, without running the REST server.
Whenever you add tests for other parts of the REST API, you need to run the suite once in record mode to generate the YAML file of HTTP requests and responses.
Then you can run the test suite in replay mode as often as you want, and Mailman 3 needn’t even be installed on your system.
Since this branch ships with a recording file, you don’t need to run in record mode to start with.
To run the test suite in replay mode (the default), just run the following:
This will attempt to run the test suite against Python 2.7, 3.4, 3.5 and 3.6 or whatever combination of those that are available on your system.
Start by branching the Mailman 3 code base, then you should install it into a virtual environment. The easiest way to do this is with tox:
$ tox --notest -r
Now, use the virtual environment that tox creates to create a template var directory in the current directory:
$ .tox/py34/bin/mailman info
Now you need to modify the
var/etc/mailman.cfg configuration file, so that
it contains the following:
[devmode] enabled: yes testing: yes recipient: firstname.lastname@example.org [mta] smtp_port: 9025 lmtp_port: 9024 incoming: mailman.testing.mta.FakeMTA [webservice] port: 9001 [archiver.mhonarc] enable: yes [archiver.mail_archive] enable: yes [archiver.prototype] enable: yes
Now you can start Mailman 3:
$ .tox/py34/bin/mailman start
Back in your
mailmanclient branch, run the test suite in record mode:
$ tox -e record
You should now have an updated recording file (
If you find you need to re-run the test suite, you must first stop the
Mailman REST server, and then delete the
mailman.db file, since it
contains state that will mess up the
mailmanclient test suite:
$ cd <mailman3-branch> $ .tox/py34/bin/mailman stop $ rm -f var/data/mailman.db $ .tox/py34/bin/mailman start $ cd <mailmanclient-branch> $ tox -e record
Once you’re done recording the HTTP traffic, you can stop the Mailman 3 server
and you won’t need it again. It’s a good idea to commit the
changes for other users of your branch.