code: def test_run_interface(tmpdir):
      cwd = tmpdir.chdir()
      default_script_file = r.RInputSpec().script_file
  
      rc = r.RCommand(r_cmd="foo_m")
      assert not os.path.exists(
          default_script_file
      ), "scriptfile should not exist 1."
      with pytest.raises(ValueError):
          rc.run()  # script is mandatory
      assert not os.path.exists(
          default_script_file
      ), "scriptfile should not exist 2."
      if os.path.exists(default_script_file):  # cleanup
          os.remove(default_script_file)
  
      rc.inputs.script = "a=1;"
      assert not os.path.exists(
          default_script_file
      ), "scriptfile should not exist 3."
      with pytest.raises(IOError):
          rc.run()  # foo_m is not an executable
      assert os.path.exists(
          default_script_file
      ), "scriptfile should exist 3."
      if os.path.exists(default_script_file):  # cleanup
          os.remove(default_script_file)
      cwd.chdir()
  
imports: import os
  import pytest
  from nipype.interfaces import r
label_desc: Use image node_id 2 for calling a global function with example usage: test_run_interface(tmpdir) without return types