code: def test_user_code_fails(test_dir):
      tempdir = test_dir
  
      parameters = [
          sherpa.Choice(name="param_a", range=[1, 2, 3]),
          sherpa.Continuous(name="param_b", range=[0, 1]),
      ]
  
      algorithm = sherpa.algorithms.RandomSearch(max_num_trials=3)
  
      db_port = 27000
      scheduler = sherpa.schedulers.LocalScheduler()
  
      filename = os.path.join(tempdir, "test.py")
      with open(filename, "w") as f:
          f.write(testscript2)
  
      with pytest.warns(RuntimeWarning):
          results = sherpa.optimize(
              filename=filename,
              lower_is_better=True,
              algorithm=algorithm,
              parameters=parameters,
              output_dir=tempdir,
              scheduler=scheduler,
              max_concurrent=1,
              db_port=db_port,
          )
  
file_path: sherpa/tests/long_tests.py
imports: from __future__ import print_function
  import os
  import pytest
  import sherpa
  import sherpa.schedulers
  from testing_utils import *
label_desc: Use image node_id 2 for calling a global function with example usage: test_user_code_fails(test_dir) without return types