Add a pytest fixture to generate a test image

This simplifies a few things:

+ The code to set up the test images isn't repeated and can be maintained in one place.
+ Looking ahead to when use of units is enforced, there should be no need to modify tests individually.
+ It streamlines testing for cosmic rays by factoring out the addition of cosmic rays, and setups the tests up to be run with different background models with ``pytest.mark.parametrize`` instead of keeping the tests in separate functions that repeat code.