code: def test_running_test_pretrained_model_distrib_ddp_spawn(tmpdir):
      """Verify `test()` on pretrained model."""
      dm = ClassifDataModule()
      model = ClassificationModel()
  
      # exp file to get meta
      logger = tutils.get_default_logger(tmpdir)
  
      # exp file to get weights
      checkpoint = tutils.init_checkpoint_callback(logger)
  
      trainer_options = {
          "enable_progress_bar": False,
          "max_epochs": 2,
          "limit_train_batches": 2,
          "limit_val_batches": 2,
          "callbacks": [checkpoint],
          "logger": logger,
          "accelerator": "gpu",
          "devices": [0, 1],
          "strategy": "ddp_spawn",
          "default_root_dir": tmpdir,
      }
  
      # fit model
      trainer = Trainer(**trainer_options)
      trainer.fit(model, datamodule=dm)
  
      log.info(
          os.listdir(tutils.get_data_path(logger, path_dir=tmpdir))
      )
  
      # correct result and ok accuracy
      assert (
          trainer.state.finished
      ), f"Training failed with {trainer.state}"
      pretrained_model = ClassificationModel.load_from_checkpoint(
          trainer.checkpoint_callback.best_model_path
      )
  
      # run test set
      new_trainer = Trainer(**trainer_options)
      new_trainer.test(pretrained_model, datamodule=dm)
      pretrained_model.cpu()
  
      dataloaders = dm.test_dataloader()
      if not isinstance(dataloaders, list):
          dataloaders = [dataloaders]
  
      for dataloader in dataloaders:
          tpipes.run_model_prediction(
              pretrained_model, dataloader, min_acc=0.1
          )
  
imports: import glob
  import logging
  import os
  import pickle
  from copy import deepcopy
  from typing import Generic, Mapping, TypeVar
  import cloudpickle
  import pytest
  import torch
  from lightning.fabric import seed_everything
  from lightning.pytorch import Callback, Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.trainer.states import TrainerFn
  from lightning_utilities.test.warning import no_warning_call
  from torch import Tensor
  import tests_pytorch.helpers.pipelines
  import tests_pytorch.helpers.utils
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
  from tests_pytorch.loops.test_loops import CustomException
label_desc: Use image node_id 8 for calling a global function with example usage: test_running_test_pretrained_model_distrib_ddp_spawn(tmpdir) without return types