code: def test_dir_on_init_env(wandb_init):
      """Ensure that `wandb.init()` w/ env variable set creates the proper directory and nothing else."""
      default_path = os.path.join(os.getcwd(), "wandb")
      custom_env_path = os.path.join(os.getcwd(), "env_custom")
  
      # test for the case that the env variable is set
      with mock.patch.dict(os.environ, {env.DIR: custom_env_path}):
          if not os.path.isdir(custom_env_path):
              os.makedirs(custom_env_path)
          reload_fn(wandb)
          _remove_dir_if_exists(default_path)
          run = wandb_init()
          run.finish()
          assert not os.path.isdir(
              default_path
          ), "Unexpected directory at {}".format(default_path)
          assert os.path.isdir(
              custom_env_path
          ), "Expected directory at {}".format(custom_env_path)
          # And for the duplicate-run case
          _remove_dir_if_exists(default_path)
          run = wandb_init()
          run.finish()
          assert not os.path.isdir(
              default_path
          ), "Unexpected directory at {}".format(default_path)
          assert os.path.isdir(
              custom_env_path
          ), "Expected directory at {}".format(custom_env_path)
  
file_path: wandb/tests/pytest_tests/system_tests/test_core/test_wandb_integration.py
imports: import importlib
  import os
  import shutil
  import time
  from unittest import mock
  import pytest
  import wandb
  import wandb.env
label_desc: Use image node_id 6 for calling a global function with example usage: test_dir_on_init_env(wandb_init) without return types