databio / pypiper

Python toolkit for building restartable pipelines
http://pypiper.databio.org
BSD 2-Clause "Simplified" License
45 stars 9 forks source link

Tests should clean up after running #185

Open donaldcampbelljr opened 1 year ago

donaldcampbelljr commented 1 year ago

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

nsheff commented 1 year ago

sounds like a good candidate for a context manager :)

donaldcampbelljr commented 1 year ago

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

vreuter commented 1 year ago

sounds like a good candidate for a context manager :)

Yes this and/or the tmp_path fixture from pytest