Port tests to py.test