From 756fbdc2b631eaeb7f87b8ae24ad4ba54c5deebc Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Fri, 2 May 2025 03:00:30 -0500 Subject: [PATCH] Remove reload extension app setting --- azure_functions_worker/constants.py | 1 - azure_functions_worker/utils/common.py | 23 +---------------------- tests/unittests/test_utilities.py | 10 ---------- 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/azure_functions_worker/constants.py b/azure_functions_worker/constants.py index 6110752e2..c60349e63 100644 --- a/azure_functions_worker/constants.py +++ b/azure_functions_worker/constants.py @@ -46,7 +46,6 @@ PYTHON_ISOLATE_WORKER_DEPENDENCIES_DEFAULT_310 = False PYTHON_ENABLE_WORKER_EXTENSIONS_DEFAULT = False PYTHON_ENABLE_WORKER_EXTENSIONS_DEFAULT_39 = True -PYTHON_EXTENSIONS_RELOAD_FUNCTIONS = "PYTHON_EXTENSIONS_RELOAD_FUNCTIONS" # new programming model default script file name PYTHON_SCRIPT_FILE_NAME = "PYTHON_SCRIPT_FILE_NAME" diff --git a/azure_functions_worker/utils/common.py b/azure_functions_worker/utils/common.py index 963cd3c1c..cec3267bd 100644 --- a/azure_functions_worker/utils/common.py +++ b/azure_functions_worker/utils/common.py @@ -8,9 +8,7 @@ from typing import Callable, Optional from azure_functions_worker.constants import ( - CUSTOMER_PACKAGES_PATH, - PYTHON_EXTENSIONS_RELOAD_FUNCTIONS, -) + CUSTOMER_PACKAGES_PATH) def is_true_like(setting: str) -> bool: @@ -116,25 +114,6 @@ def get_sdk_from_sys_path() -> ModuleType: ModuleType The azure.functions that is loaded from the first sys.path entry """ - - if is_envvar_true(PYTHON_EXTENSIONS_RELOAD_FUNCTIONS): - backup_azure_functions = None - backup_azure = None - - if 'azure.functions' in sys.modules: - backup_azure_functions = sys.modules.pop('azure.functions') - if 'azure' in sys.modules: - backup_azure = sys.modules.pop('azure') - - module = importlib.import_module('azure.functions') - - if backup_azure: - sys.modules['azure'] = backup_azure - if backup_azure_functions: - sys.modules['azure.functions'] = backup_azure_functions - - return module - if CUSTOMER_PACKAGES_PATH not in sys.path: sys.path.insert(0, CUSTOMER_PACKAGES_PATH) diff --git a/tests/unittests/test_utilities.py b/tests/unittests/test_utilities.py index 99b014e09..7c0fceb6d 100644 --- a/tests/unittests/test_utilities.py +++ b/tests/unittests/test_utilities.py @@ -7,7 +7,6 @@ import unittest from unittest.mock import patch -from azure_functions_worker.constants import PYTHON_EXTENSIONS_RELOAD_FUNCTIONS from azure_functions_worker.utils import common, wrappers TEST_APP_SETTING_NAME = "TEST_APP_SETTING_NAME" @@ -365,15 +364,6 @@ def test_get_sdk_dummy_version(self): sdk_version = common.get_sdk_version(module) self.assertNotEqual(sdk_version, 'dummy') - def test_get_sdk_dummy_version_with_flag_enabled(self): - """Test if sdk version can get dummy sdk version - """ - os.environ[PYTHON_EXTENSIONS_RELOAD_FUNCTIONS] = '1' - sys.path.insert(0, self._dummy_sdk_sys_path) - module = common.get_sdk_from_sys_path() - sdk_version = common.get_sdk_version(module) - self.assertEqual(sdk_version, 'dummy') - def test_valid_script_file_name(self): file_name = 'test.py' common.validate_script_file_name(file_name)