Port tests to py.test; add a couple tests