code: def test_resume_auto_failure(wandb_init, tmp_path):
      # env vars have a higher priority than the BASE settings
      # so that if that is set (e.g. by some other test/fixture),
      # test_settings.wandb_dir != run_settings.wandb_dir
      # and this test will fail
      with mock.patch.dict(
          os.environ, {"WANDB_DIR": str(tmp_path.absolute())}
      ):
          run = wandb_init(project="project", id="resume-me")
          run.finish()
          resume_fname = run._settings.resume_fname
          with open(resume_fname, "w") as f:
              f.write(json.dumps({"run_id": "resume-me"}))
          run = wandb_init(resume="auto", project="project")
          assert run.id == "resume-me"
          run.finish(exit_code=3)
          assert os.path.exists(resume_fname)
  
file_path: wandb/tests/pytest_tests/system_tests/test_core/test_wandb_init.py
imports: import json
  import os
  from unittest import mock
  import pytest
  from wandb.errors import CommError, UsageError
label_desc: Use image node_id 8 for calling a global function with example usage: test_resume_auto_failure(wandb_init, tmp_path) without return types