skypyproject / skypy

SkyPy: A package for modelling the Universe.
BSD 3-Clause "New" or "Revised" License
118 stars 38 forks source link

FITS file deletion fails when tests fail #466

Closed ntessore closed 3 years ago

ntessore commented 3 years ago

When unit tests that create output FITS files fail, the test cleanup code might try to delete nonexisting files, causing other errors that are unrelated to what's actually failing in the test.

Instead of using the cleanup function, we can use a pytest tmp_path fixture to write files to a pytest temporary directory.

From their tutorial:

def mytest(tmp_path):
    out_path = tmp_path / 'test.fits'