Iwan coaches agile teams in the corporate world. This includes helping programmers to apply practices such as testing and object oriented design in the context of existing systems that have grown convoluted and debilitating over time---making the application of such practices challenging.
His spare time goes into Reahl (http://www.reahl.org) -- an experiment to try and implement a different way of thinking about web application development. Reahl offers Python classes that allow you to represent a user interface using only Python. Behind the scenes, Reahl makes your Python code work using the normal HTML/CSS/JS/HTTP, but the burden of how to do that is taken care of.
Last year at PyConZA I presented a talk about different approaches to test setup and alluded to an idea that we have been playing with at Reahl: class based test Fixtures. We have since refined our approach and built it as an add-on that works with py.test.
In this talk I briefly introduce Fixtures again for people who did not see the last year's talk. I then show more detail about the types of problems we deal with while testing and how our fixture ideas solve these issues.
For example, in our tests the database schema is created from scratch at the beginning of a test run, but the database is kept clean by rolling back a transaction between each individual test. We can also create extra temporary database tables, just for a test run.
We integrate Selenium webdriver with our web server so that the web server runs in the same thread as the tests themselves, in the same database transaction. The effect of this is that when something breaks inside the web server, the test immediately breaks as well, and gives a sensible stack trace.
In our code, we use a global context much like what Flask does. This is a design often criticised because of the fact that it makes testing difficult. We use our fixtures to hide the associated complexities regarding the global context as well.
The talk covers some details about how we use Fixtures to provide this functionality and some thoughts on where we found it useful and which things we still struggle to deal with elegantly.