code: def test_load_app_from_file_errors():
      test_script_dir = os.path.join(
          os.path.dirname(os.path.dirname(__file__)), "core", "scripts"
      )
      with pytest.raises(
          MisconfigurationException,
          match="There should not be multiple apps instantiated within a file",
      ):
          load_app_from_file(
              os.path.join(test_script_dir, "two_apps.py")
          )
  
      with pytest.raises(
          MisconfigurationException,
          match="The provided file .* does not contain a LightningApp",
      ):
          load_app_from_file(os.path.join(test_script_dir, "empty.py"))
  
      with pytest.raises(SystemExit, match="1"):
          load_app_from_file(
              os.path.join(test_script_dir, "script_with_error.py")
          )
  
file_path: pytorch-lightning/tests/tests_app/utilities/test_load_app.py
imports: import os
  import sys
  from unittest.mock import ANY
  import pytest
  from lightning.app.utilities.exceptions import MisconfigurationException
  from lightning.app.utilities.load_app import extract_metadata_from_app, load_app_from_file
label_desc: Use image node_id 1 for calling a global function with example usage: test_load_app_from_file_errors() without return types