docstr: Test that a trainer with logger errors out with a number of arguments. Test that it works with
  create_tensorboard_logger set to False
docstr_tok: ["Test","that","a","trainer","with","logger","errors","out","with","a","number","of","arguments",".","Test","that","it","works","with","create_tensorboard_logger","set","to","False"]
code: def test_trainer_loggers(self, tmp_path):
      """Test that a trainer with logger errors out with a number of arguments. Test that it works with
      create_tensorboard_logger set to False
      """
      test_trainer = pl.Trainer(
          accelerator="cpu"
      )  # Should create logger and modelcheckpoint
  
      with pytest.raises(
          LoggerMisconfigurationError
      ):  # Fails because exp_manager defaults to trainer
          exp_manager(test_trainer, {"exp_dir": str(tmp_path)})
      with pytest.raises(
          LoggerMisconfigurationError
      ):  # Fails because exp_manager defaults to trainer
          exp_manager(test_trainer, {"explicit_log_dir": str(tmp_path)})
      with pytest.raises(
          LoggerMisconfigurationError
      ):  # Fails because exp_manager defaults to trainer
          exp_manager(test_trainer, {"resume_if_exists": True})
  
      # Check that exp_manager uses trainer.logger, it's exp_dir, name, and version
      log_dir = exp_manager(
          test_trainer,
          {
              "create_tensorboard_logger": False,
              "create_checkpoint_callback": False,
          },
      )
      assert (
          log_dir.resolve()
          == Path("./lightning_logs/version_0").resolve()
      )
      assert Path("./lightning_logs").exists()
      assert Path("./lightning_logs/version_0").exists()
  
      # Check that a trainer without a logger gets a logger attached to it
      test_trainer = pl.Trainer(accelerator="cpu", logger=False)
      log_dir = exp_manager(
          test_trainer,
          {
              "create_tensorboard_logger": True,
              "create_checkpoint_callback": False,
              "exp_dir": str(tmp_path),
          },
      )
      assert isinstance(
          test_trainer.logger, pl.loggers.TensorBoardLogger
      )
  
      test_trainer = pl.Trainer(accelerator="cpu", logger=False)
      # Check that a create_wandb_logger=True errors out unless wandb_logger_kwargs is passed.
      with pytest.raises(ValueError):
          log_dir = exp_manager(
              test_trainer,
              {
                  "create_tensorboard_logger": False,
                  "create_checkpoint_callback": False,
                  "exp_dir": str(tmp_path),
                  "create_wandb_logger": True,
              },
          )
      # Check that a WandbLogger is attached to logger if create_wandb_logger=True and wandb_logger_kwargs has name
      # and project
      log_dir = exp_manager(
          test_trainer,
          {
              "create_tensorboard_logger": False,
              "create_checkpoint_callback": False,
              "exp_dir": str(tmp_path),
              "create_wandb_logger": True,
              "wandb_logger_kwargs": {
                  "name": "",
                  "project": "",
                  "offline": True,
              },
          },
      )
      assert isinstance(test_trainer.logger, pl.loggers.WandbLogger)
  
imports: import math
  import os
  import re
  from pathlib import Path
  from typing import Any
  import pytest
  import pytorch_lightning
  import torch
  from omegaconf import OmegaConf
  from omegaconf.errors import OmegaConfBaseException
  from pytorch_lightning import Callback
  from pytorch_lightning.loops import _TrainingEpochLoop
  from nemo.constants import NEMO_ENV_VARNAME_VERSION
  from nemo.core.classes import ModelPT
  from nemo.utils.exp_manager import CheckpointMisconfigurationError, LoggerMisconfigurationError, NotFoundError, exp_manager
label_desc: Use image node_id 2 for calling the TestExpManager obj's underlying member method code with example usage: obj.test_trainer_loggers(tmp_path) without return types