code: def test_train(tmp_path, capfd):
      warnings.filterwarnings(
          "ignore", ".*does not have many workers.*"
      )
  
      import pytorch_lightning as pl
  
      load_cfg(cfg, args)
      cfg.out_dir = osp.join(tmp_path, "out_dir")
      cfg.run_dir = osp.join(tmp_path, "run_dir")
      cfg.dataset.dir = osp.join(
          "/", "tmp", "pyg_test_datasets", "Planetoid"
      )
  
      set_out_dir(cfg.out_dir, args.cfg_file)
      dump_cfg(cfg)
      set_printing()
  
      seed_everything(cfg.seed)
      auto_select_device()
      set_run_dir(cfg.out_dir)
  
      loaders = create_loader()
      model = create_model()
      cfg.params = params_count(model)
      logger = LoggerCallback()
      trainer = pl.Trainer(
          max_epochs=1,
          max_steps=4,
          callbacks=logger,
          log_every_n_steps=1,
      )
      train_loader, val_loader = loaders[0], loaders[1]
      trainer.fit(model, train_loader, val_loader)
  
      out, err = capfd.readouterr()
      assert "Sanity Checking" in out
      assert "Epoch 0:" in out
  
imports: import os.path
  import warnings
  from collections import namedtuple
  import pytest
  import torch
  from torch_geometric import seed_everything
  from torch_geometric.graphgym import register
  from torch_geometric.graphgym.checkpoint import get_ckpt_dir
  from torch_geometric.graphgym.config import cfg, dump_cfg, load_cfg, set_out_dir, set_run_dir
  from torch_geometric.graphgym.loader import create_loader
  from torch_geometric.graphgym.logger import LoggerCallback, set_printing
  from torch_geometric.graphgym.model_builder import create_model
  from torch_geometric.graphgym.models.gnn import FeatureEncoder, GNNStackStage
  from torch_geometric.graphgym.models.head import GNNNodeHead
  from torch_geometric.graphgym.train import GraphGymDataModule, train
  from torch_geometric.graphgym.utils import agg_runs, auto_select_device, params_count
  from torch_geometric.testing import onlyOnline, withPackage
label_desc: Use image node_id 4 for calling a global function with example usage: test_train(tmp_path, capfd) without return types