def test_sync_batchnorm_invalid_choice():
    """Test that a conflicting specification of enabled sync batchnorm and a custom plugin leads to an error."""
    custom = Mock(spec=LayerSync)
    with pytest.raises(
        MisconfigurationException,
        match=r"You set `Trainer\(sync_batchnorm=True\)` and provided a `LayerSync` plugin, but this is not allowed",
    ):
        Trainer(sync_batchnorm=True, plugins=[custom])
Test that a conflicting specification of enabled sync batchnorm and a custom plugin leads to an error.
tests/tests_pytorch/trainer/connectors/test_accelerator_connector.py