diff --git a/tests/test_compare.py b/tests/test_compare.py index e81f959..b6a84bc 100644 --- a/tests/test_compare.py +++ b/tests/test_compare.py @@ -21,6 +21,7 @@ from pathlib import Path import pytest +import shutil from lisfloodutilities.compare.pcr import PCRComparator, TSSComparator from lisfloodutilities.compare.nc import NetCDFComparator @@ -55,6 +56,11 @@ def test_netcdfcomp_diffdirs(self): assert comp.diff_folder.joinpath('a_a.nc').exists(), 'Diff file A does not exist in %s' % comp.diff_folder assert comp.diff_folder.joinpath('a_b.nc').exists(), 'Diff file B does not exist' assert comp.diff_folder.joinpath('a_diff.nc').exists(), 'Diff file diff.nc does not exist' + # Clean the diff folder after the test since it is no longer needed + if comp.diff_folder is not None and comp.diff_folder.parent.name == 'diffs': + shutil.rmtree(comp.diff_folder.parent) + else: + shutil.rmtree(comp.diff_folder) def test_netcdfcomp_submask(self): comp = NetCDFComparator(mask='tests/data/submask/subcatchment_mask.map')