Port from nose to py.test