Fix tests that break with py.test