code: def test_warn_cpu():
      def f(*a):
          @ray.remote(num_cpus=1)
          def f():
              pass
  
          ray.get(f.remote())
  
      with pytest.raises(TuneError):
          tune.run(f, verbose=0)
  
      with pytest.raises(TuneError):
          tune.run(
              f,
              resources_per_trial=tune.PlacementGroupFactory(
                  [{"CPU": 1}]
              ),
              verbose=0,
          )
  
      def g(*a):
          @ray.remote(num_cpus=1)
          class Actor:
              def f(self):
                  pass
  
          a = Actor.remote()
          ray.get(a.f.remote())
  
      with pytest.raises(TuneError):
          tune.run(g, verbose=0)
  
      with pytest.raises(TuneError):
          tune.run(
              g,
              resources_per_trial=tune.PlacementGroupFactory(
                  [{"CPU": 1}]
              ),
              verbose=0,
          )
  
file_path: ray/python/ray/tune/tests/test_warnings.py
imports: import pytest
  import ray
  from ray import tune
  from ray.data.context import DataContext
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
  from ray.tune.error import TuneError
label_desc: Use image node_id 2 for calling a global function with example usage: test_warn_cpu() without return types