code: def test_code_saving(notebook):
      # TODO: make this test work with the unmock server
      # TODO: this is awfully slow, we should likely run these in parallel
      # with notebook("code_saving.ipynb") as nb:
      #     nb.execute_all()
      #     server_ctx = live_mock_server.get_ctx()
      #     artifact_name = list(server_ctx["artifacts"].keys())[0]
      #     print("Artifacts: ", server_ctx["artifacts"][artifact_name])
      #     # We run 3 cells after calling wandb.init
      #     valid = [3]
      #     # TODO: (cvp) for reasons unclear this is flaky.  I've verified the artifacts
      #     # are being logged from the sender thread.  This is either a race in the mock_server
      #     # or a legit windows bug.
      #     if platform.system() == "Windows":
      #         valid.append(1)  # See WB-6964 for info when hack was extended
      #         valid.append(2)
      #     assert len(server_ctx["artifacts"][artifact_name]) in valid
  
      with notebook("code_saving.ipynb", save_code=False) as nb:
          nb.execute_all()
          assert (
              "Failed to detect the name of this notebook"
              in nb.all_output_text()
          )
  
      # Let's make sure we warn the user if they lie to us.
      with notebook("code_saving.ipynb") as nb:
          os.remove("code_saving.ipynb")
          nb.execute_all()
          assert (
              "WANDB_NOTEBOOK_NAME should be a path"
              in nb.all_output_text()
          )
  
imports: import json
  import os
  import pathlib
  import platform
  import subprocess
  import sys
  from unittest import mock
  import pytest
  import wandb
  import wandb.jupyter
  import wandb.sdk.lib.apikey
  import wandb.util
label_desc: Use image node_id 15 for calling a global function with example usage: test_code_saving(notebook) without return types