From 7f79e49aea06b71fc55c844b4dafc3ba4f23eb66 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 11 May 2021 19:09:29 -0400 Subject: [PATCH] Fix test --- tests/accelerators/test_accelerator_connector.py | 8 +++++--- tests/trainer/test_trainer.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/accelerators/test_accelerator_connector.py b/tests/accelerators/test_accelerator_connector.py index fc24401aa106cc..711be8ebd04134 100644 --- a/tests/accelerators/test_accelerator_connector.py +++ b/tests/accelerators/test_accelerator_connector.py @@ -430,13 +430,15 @@ def test_ipython_incompatible_backend_error(*_): with pytest.raises(MisconfigurationException, match="backend ddp is not compatible"): Trainer(accelerator="ddp", gpus=2) - with pytest.raises(MisconfigurationException, match="backend ddp is not compatible"): - Trainer(accelerator="ddp_cpu", num_processes=2) - with pytest.raises(MisconfigurationException, match="backend ddp2 is not compatible"): Trainer(accelerator="ddp2", gpus=2) +@mock.patch("pytorch_lightning.utilities._IS_INTERACTIVE", return_value=True) +def test_ipython_compatible_backend(*_): + Trainer(accelerator="ddp_cpu", num_processes=2) + + @pytest.mark.parametrize( ["accelerator", "plugin"], [('ddp_spawn', 'ddp_sharded'), (None, 'ddp_sharded')], diff --git a/tests/trainer/test_trainer.py b/tests/trainer/test_trainer.py index 19de7b0a985d4a..41321d8291e1d1 100644 --- a/tests/trainer/test_trainer.py +++ b/tests/trainer/test_trainer.py @@ -1132,7 +1132,7 @@ def test_num_sanity_val_steps_neg_one(tmpdir, limit_val_batches): ), ( dict(accelerator="ddp_cpu", num_processes=2, gpus=None), - dict(_distrib_type=DistributedType.DDP, _device_type=DeviceType.CPU, num_gpus=0, num_processes=2), + dict(_distrib_type=DistributedType.DDP_SPAWN, _device_type=DeviceType.CPU, num_gpus=0, num_processes=2), ), ( dict(accelerator="ddp2", gpus=None),