code: def test_publish_cloudrun_memory_cpu(
      mock_call,
      mock_output,
      mock_which,
      memory,
      cpu,
      timeout,
      min_instances,
      max_instances,
      expected_gcloud_args,
      tmp_path_factory,
  ):
      mock_output.return_value = "myproject"
      mock_which.return_value = True
      runner = CliRunner()
      os.chdir(tmp_path_factory.mktemp("runner"))
      with open("test.db", "w") as fp:
          fp.write("data")
      args = ["publish", "cloudrun", "test.db", "--service", "test"]
      if memory:
          args.extend(["--memory", memory])
      if cpu:
          args.extend(["--cpu", str(cpu)])
      if timeout:
          args.extend(["--timeout", str(timeout)])
      result = runner.invoke(cli.cli, args)
      if expected_gcloud_args is None:
          assert 2 == result.exit_code
          return
      assert 0 == result.exit_code
      tag = f"gcr.io/{mock_output.return_value}/datasette-test"
      expected_call = (
          "gcloud run deploy --allow-unauthenticated --platform=managed"
          " --image {} test".format(tag)
      )
      expected_build_call = f"gcloud builds submit --tag {tag}"
      if memory:
          expected_call += " --memory {}".format(memory)
      if cpu:
          expected_call += " --cpu {}".format(cpu)
      if timeout:
          expected_build_call += f" --timeout {timeout}"
      mock_call.assert_has_calls(
          [
              mock.call(expected_build_call, shell=True),
              mock.call(
                  expected_call,
                  shell=True,
              ),
          ]
      )
  
file_path: datasette/tests/test_publish_cloudrun.py
imports: from click.testing import CliRunner
  from datasette import cli
  from unittest import mock
  import json
  import os
  import pytest
  import textwrap
label_desc: Use image node_id 5 for calling a global function with example usage: test_publish_cloudrun_memory_cpu(mock_call, mock_output, mock_which, memory, cpu, timeout, min_instances, max_instances, expected_gcloud_args, tmp_path_factory) without return types