code: def test_load_app_from_file(app_path):
      """Test that apps load without error and that sys.path and main module are set."""
      original_main = sys.modules["__main__"]
      test_script_dir = os.path.join(
          os.path.dirname(os.path.dirname(__file__)), "core", "scripts"
      )
      load_app_from_file(
          os.path.join(test_script_dir, app_path), raise_exception=True
      )
  
      assert test_script_dir in sys.path
      assert sys.modules["__main__"] != original_main
  
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 2 for calling a global function with example usage: test_load_app_from_file(app_path) without return types