We’re using z3c.testsetup for quick and easy test setup. I wrote about our test setup with layers and z3c.testsetup a few weeks ago. We’ve had problems with that specific setup and I’ve spend a day devising a new setup and implementing it in three projects.
With the customary
ftesting.zcml in the tests/ directory, I’m using the
functional-zcml-layer marker to point at that file. If z3c.testsetup
sees this, it sets up a functional testing layer for that ftesting.zcml
Other tests need some additional setup (in my case grokking of some extra
fixtures.zcml includes the ftesting.zcml and does the
extra work. The tests with
functional-zcml-layer: fixtures.zcml are run
on a different functional test layer.
A setup method sets up globals for the testcase. Another setup method also
sets up a demo site and some users. Depending on the needs, I put a
setup: path.to.setup_method in my doctest and everything is set up just
The top of such a doctest looks like:
.. :doctest: .. :functional-zcml-layer: ftesting.zcml .. :setup: path.to.setup_method
Now for the timely update I mentioned in the title. We also have a test
script that runs the tests of the project itself plus many dependencies. And
z3c.testsetup mixed up two test layers that both pointed at
ftesting.zcml. project1/ftesting.zcml and project2/ftesting.zcml, but
they got treated as one and the same test layer. Sigh.
But just today, z3c.testsetup 0.4 was released that fixes this very issue. A patch by Jonathan Ballet. Thanks a lot! Just-in-time bug fixing :-)
My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):