def test_spawn_predict_return_predictions(tmp_path):
    """Test that `return_predictions=True` raise a MisconfigurationException with spawn strategies."""
    model = BoringModel()
    trainer = Trainer(default_root_dir=tmp_path, accelerator="cpu", strategy="ddp_spawn", devices=2, fast_dev_run=True)
    assert isinstance(trainer.strategy, DDPStrategy)
    with pytest.raises(ProcessRaisedException, match="`return_predictions` should be set to `False`"):
        trainer.predict(model, dataloaders=model.train_dataloader(), return_predictions=True)
Test that `return_predictions=True` raise a MisconfigurationException with spawn strategies.
tests/tests_pytorch/trainer/test_trainer.py