If the tests generate files, those files should also be cleaned up by the tests. Preferably use a temporary directory as e.g. https://github.com/mne-tools/mne-python/blob/master/mne/tests/test_source_estimate.py