code: def test_launch_repository_arg(
      relay_server,
      monkeypatch,
      runner,
      args,
      user,
      wandb_init,
      test_settings,
  ):
      base_args = [
          "-u",
          "https://github.com/wandb/examples",
          "--entity",
          user,
      ]
  
      async def patched_launch(
          uri,
          job,
          api,
          name,
          project,
          entity,
          docker_image,
          resource,
          entry_point,
          version,
          resource_args,
          launch_config,
          synchronous,
          run_id,
          repository,
      ):
          assert (
              repository
              or "--repository=" in args
              or "--repository" in args
          )
  
          mock_run = Mock()
          rv = Mock()
          rv.state = "finished"
  
          async def _mock_get_status():
              return rv
  
          mock_run.get_status = _mock_get_status
          return mock_run
  
      monkeypatch.setattr(
          "wandb.sdk.launch._launch._launch",
          patched_launch,
      )
  
      def patched_fetch_and_val(launch_project, _):
          return launch_project
  
      monkeypatch.setattr(
          "wandb.sdk.launch._launch.fetch_and_validate_project",
          patched_fetch_and_val,
      )
  
      monkeypatch.setattr(
          wandb.sdk.launch.builder.build,
          "validate_docker_installation",
          lambda: None,
      )
  
      monkeypatch.setattr(
          "wandb.docker",
          lambda: "testing",
      )
  
      with runner.isolated_filesystem(), relay_server():
          result = runner.invoke(cli.launch, base_args + args)
  
          if (
              "--respository=" in args or "--repository" in args
          ):  # incorrect param
              assert result.exit_code == 2
          else:
              assert result.exit_code == 0
  
imports: import json
  from unittest.mock import Mock
  import pytest
  import wandb
  from wandb.cli import cli
  from wandb.sdk.launch.errors import LaunchError
label_desc: Use image node_id 4 for calling a global function with example usage: test_launch_repository_arg(relay_server, monkeypatch, runner, args, user, wandb_init, test_settings) and returns: mock_run, launch_project, rv