pypiper icon indicating copy to clipboard operation
pypiper copied to clipboard

Tests should clean up after running

Open donaldcampbelljr opened this issue 2 years ago • 3 comments

Currently, it appears that tests for pypiper are generating results in a tmp directory that is not being cleaned up once pytesting is finished.

donaldcampbelljr avatar Jun 12 '23 15:06 donaldcampbelljr

sounds like a good candidate for a context manager :)

nsheff avatar Jun 12 '23 20:06 nsheff

Related, the unit test test_pipeline_manager.py is leaving 'failed' flag files after closing the test: example: default_pipeline_name_sample_pipeline_failed.flag

However, they should be cleaned up via the function:

    OUTFOLDER = "tests/Data/pipeline_output"

    @classmethod
    def _clean(cls):
        for d in glob.glob(cls.OUTFOLDER + "*"):
            if os.path.isdir(d):
                print("Removing " + d)
                shutil.rmtree(d)

Also added status clearing at the very end of the unit test.

Next steps: -Investigate using context manager

donaldcampbelljr avatar Jun 14 '23 19:06 donaldcampbelljr

sounds like a good candidate for a context manager :)

Yes this and/or the tmp_path fixture from pytest

vreuter avatar Aug 02 '23 11:08 vreuter