def test_torchelastic_priority_over_slurm(*_):
    """Test that the TorchElastic cluster environment is chosen over SLURM when both are detected."""
    assert TorchElasticEnvironment.detect()
    assert SLURMEnvironment.detect()
    connector = _AcceleratorConnector(strategy="ddp")
    assert isinstance(connector.strategy.cluster_environment, TorchElasticEnvironment)
Test that the TorchElastic cluster environment is chosen over SLURM when both are detected.
tests/tests_pytorch/trainer/connectors/test_accelerator_connector.py