From 3affa0e49aac25ed0e02bea777d995c5219e5719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 23 Sep 2020 13:44:15 +0200 Subject: [PATCH] use tmpdir in tests when writing predictions to disk (#3561) * save to tmpdir * path --- tests/core/test_results.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/core/test_results.py b/tests/core/test_results.py index 57fbf52f8e..9f7117b681 100644 --- a/tests/core/test_results.py +++ b/tests/core/test_results.py @@ -79,7 +79,7 @@ def test_result_obj_predictions(tmpdir, test_option, do_train, gpus): tutils.reset_seed() dm = TrialMNISTDataModule(tmpdir) - prediction_file = Path('predictions.pt') + prediction_file = Path(tmpdir) / 'predictions.pt' model = EvalModelTemplate() model.test_option = test_option @@ -131,7 +131,7 @@ def test_result_obj_predictions_ddp_spawn(tmpdir): dm = TrialMNISTDataModule(tmpdir) - prediction_file = Path('predictions.pt') + prediction_file = Path(tmpdir) / 'predictions.pt' model = EvalModelTemplate(learning_rate=0.005) model.test_option = option @@ -141,7 +141,7 @@ def test_result_obj_predictions_ddp_spawn(tmpdir): model.test_epoch_end = None model.test_end = None - prediction_files = [Path('predictions_rank_0.pt'), Path('predictions_rank_1.pt')] + prediction_files = [Path(tmpdir) / 'predictions_rank_0.pt', Path(tmpdir) / 'predictions_rank_1.pt'] for prediction_file in prediction_files: if prediction_file.exists(): prediction_file.unlink()