Refactor the unit test to use pytest, which simplifies it quite a bit