From ff8922f9f21f7fc8501d035dae25b15bc2787391 Mon Sep 17 00:00:00 2001 From: wawltor Date: Wed, 14 Oct 2020 17:55:38 +0800 Subject: [PATCH] fix the dataset remove bug for the dataset fix the dataset remove bug for the dataset --- .../fluid/tests/unittests/test_dataset.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_dataset.py b/python/paddle/fluid/tests/unittests/test_dataset.py index 276d91fa02..7facc99a07 100644 --- a/python/paddle/fluid/tests/unittests/test_dataset.py +++ b/python/paddle/fluid/tests/unittests/test_dataset.py @@ -559,8 +559,10 @@ class TestDataset(unittest.TestCase): except Exception as e: self.assertTrue(False) - os.remove("./test_queue_dataset_run_a.txt") - os.remove("./test_queue_dataset_run_b.txt") + if os.path.exists("./test_queue_dataset_run_a.txt"): + os.remove("./test_queue_dataset_run_a.txt") + if os.path.exists("./test_queue_dataset_run_b.txt"): + os.remove("./test_queue_dataset_run_b.txt") def test_queue_dataset_run_2(self): """ @@ -611,8 +613,10 @@ class TestDataset(unittest.TestCase): except Exception as e: self.assertTrue(False) - os.remove("./test_queue_dataset_run_a.txt") - os.remove("./test_queue_dataset_run_b.txt") + if os.path.exists("./test_queue_dataset_run_a.txt"): + os.remove("./test_queue_dataset_run_a.txt") + if os.path.exists("./test_queue_dataset_run_b.txt"): + os.remove("./test_queue_dataset_run_b.txt") def test_queue_dataset_run_3(self): """ @@ -669,8 +673,10 @@ class TestDataset(unittest.TestCase): except Exception as e: self.assertTrue(False) - os.remove("./test_queue_dataset_run_a.txt") - os.remove("./test_queue_dataset_run_b.txt") + if os.path.exists("./test_queue_dataset_run_a.txt"): + os.remove("./test_queue_dataset_run_a.txt") + if os.path.exists("./test_queue_dataset_run_b.txt"): + os.remove("./test_queue_dataset_run_b.txt") class TestDatasetWithDataLoader(TestDataset): -- GitLab