code: def test_errors():
      with popen(
          [
              "dask",
              "spec",
              "--spec",
              '{"foo": "bar"}',
              "--spec-file",
              "foo.yaml",
          ],
          capture_output=True,
      ) as proc:
          line = proc.stdout.readline().decode()
          assert "exactly one" in line
          assert "--spec" in line and "--spec-file" in line
  
      with popen(["dask", "spec"], capture_output=True) as proc:
          line = proc.stdout.readline().decode()
          assert "exactly one" in line
          assert "--spec" in line and "--spec-file" in line
  
file_path: distributed/distributed/cli/tests/test_dask_spec.py
imports: from __future__ import annotations
  import asyncio
  import json
  import signal
  import subprocess
  import pytest
  import yaml
  from distributed import Client
  from distributed.compatibility import WINDOWS
  from distributed.utils import open_port
  from distributed.utils_test import gen_cluster, gen_test, popen
label_desc: Use image node_id 1 for calling a global function with example usage: test_errors() without return types