Replace common test instantiations with pytest fixtures

Removing some duplication in the test source code.