Skip to content

Commit b9e1a9c

Browse files
committed
fix test after deprecated code as in #14693
1 parent ed07fc8 commit b9e1a9c

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

tests/tests_lite/strategies/test_ddp.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,22 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
import os
15-
from unittest import mock
16-
1714
import pytest
1815
import torch
1916

2017
from lightning_lite.strategies import DDPStrategy
2118

2219

2320
@pytest.mark.parametrize(
24-
["process_group_backend", "env_var", "device_str", "expected_process_group_backend"],
21+
["process_group_backend", "device_str", "expected_process_group_backend"],
2522
[
26-
pytest.param("foo", None, "cpu", "foo"),
27-
pytest.param("foo", "BAR", "cpu", "foo"),
28-
pytest.param("foo", "BAR", "cuda:0", "foo"),
29-
pytest.param(None, "BAR", "cuda:0", "BAR"),
30-
pytest.param(None, None, "cuda:0", "nccl"),
31-
pytest.param(None, None, "cpu", "gloo"),
23+
pytest.param("foo", "cpu", "foo"),
24+
pytest.param("foo", "cuda:0", "foo"),
25+
pytest.param(None, "cuda:0", "nccl"),
26+
pytest.param(None, "cpu", "gloo"),
3227
],
3328
)
34-
def test_ddp_process_group_backend(process_group_backend, env_var, device_str, expected_process_group_backend):
29+
def test_ddp_process_group_backend(process_group_backend, device_str, expected_process_group_backend):
3530
"""Test settings for process group backend."""
3631

3732
class MockDDPStrategy(DDPStrategy):
@@ -44,11 +39,4 @@ def root_device(self):
4439
return self._root_device
4540

4641
strategy = MockDDPStrategy(process_group_backend=process_group_backend, root_device=torch.device(device_str))
47-
if not process_group_backend and env_var:
48-
with mock.patch.dict(os.environ, {"PL_TORCH_DISTRIBUTED_BACKEND": env_var}):
49-
with pytest.deprecated_call(
50-
match="Environment variable `PL_TORCH_DISTRIBUTED_BACKEND` was deprecated in v1.6"
51-
):
52-
assert strategy._get_process_group_backend() == expected_process_group_backend
53-
else:
54-
assert strategy._get_process_group_backend() == expected_process_group_backend
42+
assert strategy._get_process_group_backend() == expected_process_group_backend

0 commit comments

Comments
 (0)