diff --git a/tests/ut/python/dataset/test_pyfunc.py b/tests/ut/python/dataset/test_pyfunc.py index 3856166a8d7..abe11940274 100644 --- a/tests/ut/python/dataset/test_pyfunc.py +++ b/tests/ut/python/dataset/test_pyfunc.py @@ -16,6 +16,7 @@ import numpy as np import pytest import mindspore.dataset as ds +import mindspore.dataset.engine.iterators as it from mindspore import log as logger DATA_DIR = ["../data/dataset/testPyfuncMap/data.data"] @@ -321,6 +322,10 @@ def test_pyfunc_implicit_compose(): def test_pyfunc_exception(): logger.info("Test PyFunc Exception Throw: lambda x : raise Exception()") + # Sometimes there are some ITERATORS left in ITERATORS_LIST when run all UTs together, + # and cause core dump and blocking in this UT. Add cleanup() here to fix it. + it._cleanup() # pylint: disable=W0212 + def pyfunc(x): raise Exception("Pyfunc Throw") @@ -355,6 +360,10 @@ def test_func_with_yield_manifest_dataset_01(): for i in range(10): yield (np.array([i]),) + # Sometimes there are some ITERATORS left in ITERATORS_LIST when run all UTs together, + # and cause core dump and blocking in this UT. Add cleanup() here to fix it. + it._cleanup() # pylint: disable=W0212 + DATA_FILE = "../data/dataset/testManifestData/test.manifest" data = ds.ManifestDataset(DATA_FILE) data = data.map(operations=pass_func, input_columns=["image"], num_parallel_workers=1, python_multiprocessing=True,