use tmpdir in tests when writing predictions to disk (#3561)

* save to tmpdir

* path
This commit is contained in:
Adrian Wälchli 2020-09-23 13:44:15 +02:00 committed by GitHub
parent 2db86381c6
commit 3affa0e49a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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()