Finish migrating tests infrastructure to py.test.

Thanks Marc Abramowitz for most of the effort in actual porting.