def test_validate_user_settings():
    """Test that the environment can validate the number of devices and nodes set in Fabric/Trainer."""
    env = TorchElasticEnvironment()
    env.validate_settings(num_devices=4, num_nodes=2)
    with pytest.raises(ValueError, match=re.escape("the product (2 * 2) does not match the world size (8)")):
        env.validate_settings(num_devices=2, num_nodes=2)
Test that the environment can validate the number of devices and nodes set in Fabric/Trainer.
tests/tests_fabric/plugins/environments/test_torchelastic.py