From 2f8f424201d905ab1f5d9c5acef158c970e3b00c Mon Sep 17 00:00:00 2001 From: hallvictoria <59299039+hallvictoria@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:34:31 -0500 Subject: [PATCH] fix: unique function names (#1557) * initial test fixes * del function_app * refactor variables into separate file e2e & unit tests * refactor variables for all pipelines * typo * absolute paths * run all db tests * typo --------- Co-authored-by: Victoria Hall --- eng/ci/core-tools-tests.yml | 5 +- eng/ci/custom-image-tests.yml | 4 +- eng/ci/docker-consumption-tests.yml | 4 +- eng/ci/docker-dedicated-tests.yml | 4 +- eng/ci/integration-tests.yml | 9 +- eng/ci/official-build.yml | 5 +- eng/ci/public-build.yml | 5 +- eng/scripts/test-extensions.sh | 2 +- eng/scripts/test-sdk.sh | 2 +- eng/templates/official/jobs/ci-e2e-tests.yml | 2 +- eng/templates/utils/official-variables.yml | 4 + eng/templates/utils/variables.yml | 5 + ...s_enabled.py => test_deferred_bindings.py} | 99 +++++++++++++++++-- .../test_deferred_bindings_disabled.py | 68 ------------- .../test_deferred_bindings_enabled_dual.py | 75 -------------- tests/unittests/test_dispatcher.py | 12 ++- 16 files changed, 122 insertions(+), 183 deletions(-) create mode 100644 eng/templates/utils/official-variables.yml create mode 100644 eng/templates/utils/variables.yml rename tests/extension_tests/deferred_bindings_tests/{test_deferred_bindings_enabled.py => test_deferred_bindings.py} (55%) delete mode 100644 tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_disabled.py delete mode 100644 tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_enabled_dual.py diff --git a/eng/ci/core-tools-tests.yml b/eng/ci/core-tools-tests.yml index 2cb5e6b5..a62683f6 100644 --- a/eng/ci/core-tools-tests.yml +++ b/eng/ci/core-tools-tests.yml @@ -10,9 +10,8 @@ resources: ref: refs/tags/release variables: - - template: /ci/variables/build.yml@eng - - template: /ci/variables/cfs.yml@eng - - group: python-integration-resources + - template: /eng/templates/utils/official-variables.yml@self + extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es parameters: diff --git a/eng/ci/custom-image-tests.yml b/eng/ci/custom-image-tests.yml index e5a6fa9f..95956683 100644 --- a/eng/ci/custom-image-tests.yml +++ b/eng/ci/custom-image-tests.yml @@ -10,9 +10,7 @@ resources: ref: refs/tags/release variables: - - template: /ci/variables/build.yml@eng - - template: /ci/variables/cfs.yml@eng - - group: python-integration-resources + - template: /eng/templates/utils/official-variables.yml@self extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es diff --git a/eng/ci/docker-consumption-tests.yml b/eng/ci/docker-consumption-tests.yml index 59e90ac9..d1de145a 100644 --- a/eng/ci/docker-consumption-tests.yml +++ b/eng/ci/docker-consumption-tests.yml @@ -21,9 +21,7 @@ resources: ref: refs/tags/release variables: - - template: /ci/variables/build.yml@eng - - template: /ci/variables/cfs.yml@eng - - group: python-integration-resources + - template: /eng/templates/utils/official-variables.yml@self extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es diff --git a/eng/ci/docker-dedicated-tests.yml b/eng/ci/docker-dedicated-tests.yml index d0f00244..518b0339 100644 --- a/eng/ci/docker-dedicated-tests.yml +++ b/eng/ci/docker-dedicated-tests.yml @@ -21,9 +21,7 @@ resources: ref: refs/tags/release variables: - - template: /ci/variables/build.yml@eng - - template: /ci/variables/cfs.yml@eng - - group: python-integration-resources + - template: /eng/templates/utils/official-variables.yml@self extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es diff --git a/eng/ci/integration-tests.yml b/eng/ci/integration-tests.yml index 5cf0ab87..6f8f69d9 100644 --- a/eng/ci/integration-tests.yml +++ b/eng/ci/integration-tests.yml @@ -31,13 +31,8 @@ resources: ref: refs/tags/release variables: - - template: /ci/variables/build.yml@eng - - template: /ci/variables/cfs.yml@eng - - group: python-integration-resources - - name: isSdkRelease - value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/sdk/')] - - name: isExtensionsRelease - value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/extensions/')] + - template: /eng/templates/utils/variables.yml@self + - template: /eng/templates/utils/official-variables.yml@self extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index ea0fa2e6..8ac6231d 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -28,9 +28,8 @@ resources: ref: refs/tags/release variables: - - template: /ci/variables/build.yml@eng - - template: /ci/variables/cfs.yml@eng - - group: python-integration-resources + - template: /eng/templates/utils/variables.yml@self + - template: /eng/templates/utils/official-variables.yml@self extends: template: v1/1ES.Official.PipelineTemplate.yml@1es diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml index 39acfd21..67559744 100644 --- a/eng/ci/public-build.yml +++ b/eng/ci/public-build.yml @@ -27,10 +27,7 @@ resources: ref: refs/tags/release variables: - - name: isSdkRelease - value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/sdk/')] - - name: isExtensionsRelease - value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/extensions/')] + - template: /eng/templates/utils/variables.yml@self extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es diff --git a/eng/scripts/test-extensions.sh b/eng/scripts/test-extensions.sh index 033442bd..7166dc8e 100644 --- a/eng/scripts/test-extensions.sh +++ b/eng/scripts/test-extensions.sh @@ -3,7 +3,7 @@ python -m pip install --upgrade pip if [[ $2 != "3.7" ]]; then python -m pip install -e $1/PythonExtensionArtifact - python -m pip install --pre -U -e .[test-http-v2] + python -m pip install --pre -e .[test-http-v2] fi if [[ $2 != "3.7" && $2 != "3.8" ]]; then python -m pip install -e $1/PythonExtensionArtifact diff --git a/eng/scripts/test-sdk.sh b/eng/scripts/test-sdk.sh index 53017888..649a58a2 100644 --- a/eng/scripts/test-sdk.sh +++ b/eng/scripts/test-sdk.sh @@ -2,7 +2,7 @@ python -m pip install --upgrade pip python -m pip install -e $1/PythonSdkArtifact -python -m pip install -U -e .[dev] +python -m pip install -e .[dev] if [[ $2 != "3.7" ]]; then python -m pip install --pre -U -e .[test-http-v2] diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index 5d75fef3..b69d9090 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -116,7 +116,7 @@ jobs: displayName: 'Install test python extension, dependencies and the worker' condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true)) - bash: | - python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_blob_functions.py tests/extension_tests/http_v2_tests + python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend tests/extension_tests/deferred_bindings_tests tests/extension_tests/http_v2_tests env: AzureWebJobsStorage: $(STORAGE_CONNECTION) AzureWebJobsCosmosDBConnectionString: $(COSMOSDB_CONNECTION) diff --git a/eng/templates/utils/official-variables.yml b/eng/templates/utils/official-variables.yml new file mode 100644 index 00000000..1654d7e6 --- /dev/null +++ b/eng/templates/utils/official-variables.yml @@ -0,0 +1,4 @@ +variables: + - template: /ci/variables/build.yml@eng + - template: /ci/variables/cfs.yml@eng + - group: python-integration-resources \ No newline at end of file diff --git a/eng/templates/utils/variables.yml b/eng/templates/utils/variables.yml new file mode 100644 index 00000000..6361d2d1 --- /dev/null +++ b/eng/templates/utils/variables.yml @@ -0,0 +1,5 @@ +variables: + - name: isSdkRelease + value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/sdk/')] + - name: isExtensionsRelease + value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/extensions/')] \ No newline at end of file diff --git a/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_enabled.py b/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings.py similarity index 55% rename from tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_enabled.py rename to tests/extension_tests/deferred_bindings_tests/test_deferred_bindings.py index 9b450ebe..63e95268 100644 --- a/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_enabled.py +++ b/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings.py @@ -3,6 +3,7 @@ import sys import unittest +import azure.functions as func from tests.utils import testutils from azure_functions_worker import protos @@ -20,6 +21,14 @@ 'deferred_bindings_tests' / \ 'deferred_bindings_functions' / \ 'deferred_bindings_enabled' +DEFERRED_BINDINGS_DISABLED_DIR = testutils.EXTENSION_TESTS_FOLDER / \ + 'deferred_bindings_tests' / \ + 'deferred_bindings_functions' / \ + 'deferred_bindings_disabled' +DEFERRED_BINDINGS_ENABLED_DUAL_DIR = testutils.EXTENSION_TESTS_FOLDER / \ + 'deferred_bindings_tests' / \ + 'deferred_bindings_functions' / \ + 'deferred_bindings_enabled_dual' class MockMBD: @@ -35,6 +44,7 @@ def __init__(self, version: str, source: str, "is only supported for 3.9+.") class TestDeferredBindingsEnabled(testutils.AsyncTestCase): + @testutils.retryable_test(3, 5) async def test_deferred_bindings_enabled_metadata(self): async with testutils.start_mockhost( script_root=DEFERRED_BINDINGS_ENABLED_DIR) as host: @@ -43,7 +53,9 @@ async def test_deferred_bindings_enabled_metadata(self): self.assertIsInstance(r.response, protos.FunctionMetadataResponse) self.assertEqual(r.response.result.status, protos.StatusResult.Success) + del sys.modules['function_app'] + @testutils.retryable_test(3, 5) async def test_deferred_bindings_enabled_log(self): async with testutils.start_mockhost( script_root=DEFERRED_BINDINGS_ENABLED_DIR) as host: @@ -56,11 +68,74 @@ async def test_deferred_bindings_enabled_log(self): enabled_log_present = True break self.assertTrue(enabled_log_present) + del sys.modules['function_app'] + + +@unittest.skipIf(sys.version_info.minor <= 8, "The base extension" + "is only supported for 3.9+.") +class TestDeferredBindingsDisabled(testutils.AsyncTestCase): + + @testutils.retryable_test(3, 5) + async def test_deferred_bindings_disabled_metadata(self): + async with testutils.start_mockhost( + script_root=DEFERRED_BINDINGS_DISABLED_DIR) as host: + await host.init_worker() + r = await host.get_functions_metadata() + self.assertIsInstance(r.response, protos.FunctionMetadataResponse) + self.assertEqual(r.response.result.status, + protos.StatusResult.Success) + del sys.modules['function_app'] + + @testutils.retryable_test(3, 5) + async def test_deferred_bindings_disabled_log(self): + async with testutils.start_mockhost( + script_root=DEFERRED_BINDINGS_DISABLED_DIR) as host: + await host.init_worker() + r = await host.get_functions_metadata() + disabled_log_present = False + for log in r.logs: + message = log.message + if "Deferred bindings enabled: False" in message: + disabled_log_present = True + break + self.assertTrue(disabled_log_present) + del sys.modules['function_app'] + + +@unittest.skipIf(sys.version_info.minor <= 8, "The base extension" + "is only supported for 3.9+.") +class TestDeferredBindingsEnabledDual(testutils.AsyncTestCase): + + @testutils.retryable_test(3, 5) + async def test_deferred_bindings_dual_metadata(self): + async with testutils.start_mockhost( + script_root=DEFERRED_BINDINGS_ENABLED_DUAL_DIR) as host: + await host.init_worker() + r = await host.get_functions_metadata() + self.assertIsInstance(r.response, protos.FunctionMetadataResponse) + self.assertEqual(r.response.result.status, + protos.StatusResult.Success) + del sys.modules['function_app'] + + @testutils.retryable_test(3, 5) + async def test_deferred_bindings_dual_enabled_log(self): + async with testutils.start_mockhost( + script_root=DEFERRED_BINDINGS_ENABLED_DUAL_DIR) as host: + await host.init_worker() + r = await host.get_functions_metadata() + enabled_log_present = False + for log in r.logs: + message = log.message + if "Deferred bindings enabled: True" in message: + enabled_log_present = True + break + self.assertTrue(enabled_log_present) + del sys.modules['function_app'] @unittest.skipIf(sys.version_info.minor <= 8, "The base extension" "is only supported for 3.9+.") -class TestDeferredBindingsEnabledHelpers(testutils.AsyncTestCase): +class TestDeferredBindingsHelpers(testutils.AsyncTestCase): def test_deferred_bindings_enabled_decode(self): binding = BlobClientConverter @@ -92,27 +167,31 @@ async def test_check_deferred_bindings_enabled(self): The second represents if the current binding is deferred binding. If this is True, then deferred bindings must also be enabled at the function level. - - Test type 1: type is supported, deferred_bindings_enabled is not yet set - Test type 2: type is supported, deferred_bindings_enabled is already set """ async with testutils.start_mockhost( script_root=DEFERRED_BINDINGS_ENABLED_DIR) as host: await host.init_worker() - self.assertEqual(meta.check_deferred_bindings_enabled( - BlobClient, False), (True, True)) + # Type is not supported, deferred_bindings_enabled is not yet set self.assertEqual(meta.check_deferred_bindings_enabled( - BlobClient, True), (True, True)) + func.InputStream, False), (False, False)) + # Type is not supported, deferred_bindings_enabled already set self.assertEqual(meta.check_deferred_bindings_enabled( - ContainerClient, False), (True, True)) + func.InputStream, True), (True, False)) + # Type is supported, deferred_bindings_enabled is not yet set self.assertEqual(meta.check_deferred_bindings_enabled( - ContainerClient, True), (True, True)) - + BlobClient, False), (True, True)) + self.assertEqual(meta.check_deferred_bindings_enabled( + ContainerClient, False), (True, True)) self.assertEqual(meta.check_deferred_bindings_enabled( StorageStreamDownloader, False), (True, True)) + # Type is supported, deferred_bindings_enabled is already set + self.assertEqual(meta.check_deferred_bindings_enabled( + BlobClient, True), (True, True)) + self.assertEqual(meta.check_deferred_bindings_enabled( + ContainerClient, True), (True, True)) self.assertEqual(meta.check_deferred_bindings_enabled( StorageStreamDownloader, True), (True, True)) diff --git a/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_disabled.py b/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_disabled.py deleted file mode 100644 index a138119c..00000000 --- a/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_disabled.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. -import sys -import unittest - -import azure.functions as func -from tests.utils import testutils - -from azure_functions_worker import protos -from azure_functions_worker.bindings import meta - - -DEFERRED_BINDINGS_DISABLED_DIR = testutils.EXTENSION_TESTS_FOLDER / \ - 'deferred_bindings_tests' / \ - 'deferred_bindings_functions' / \ - 'deferred_bindings_disabled' - - -@unittest.skipIf(sys.version_info.minor <= 8, "The base extension" - "is only supported for 3.9+.") -class TestDeferredBindingsDisabled(testutils.AsyncTestCase): - - async def test_deferred_bindings_disabled_metadata(self): - async with testutils.start_mockhost( - script_root=DEFERRED_BINDINGS_DISABLED_DIR) as host: - await host.init_worker() - r = await host.get_functions_metadata() - self.assertIsInstance(r.response, protos.FunctionMetadataResponse) - self.assertEqual(r.response.result.status, - protos.StatusResult.Success) - - @testutils.retryable_test(3, 5) - async def test_deferred_bindings_disabled_log(self): - async with testutils.start_mockhost( - script_root=DEFERRED_BINDINGS_DISABLED_DIR) as host: - await host.init_worker() - r = await host.get_functions_metadata() - disabled_log_present = False - for log in r.logs: - message = log.message - if "Deferred bindings enabled: False" in message: - disabled_log_present = True - break - self.assertTrue(disabled_log_present) - - -@unittest.skipIf(sys.version_info.minor <= 8, "The base extension" - "is only supported for 3.9+.") -class TestDeferredBindingsDisabledHelpers(testutils.AsyncTestCase): - - async def test_check_deferred_bindings_disabled(self): - """ - check_deferred_bindings_enabled checks if deferred bindings is enabled at fx - and single binding level. - - The first bool represents if deferred bindings is enabled at a fx level. This - means that at least one binding in the function is a deferred binding type. - - The second represents if the current binding is deferred binding. If this is - True, then deferred bindings must also be enabled at the function level. - - Test: type is not supported, deferred_bindings_enabled is not yet set - """ - async with testutils.start_mockhost( - script_root=DEFERRED_BINDINGS_DISABLED_DIR) as host: - await host.init_worker() - self.assertEqual(meta.check_deferred_bindings_enabled( - func.InputStream, False), (False, False)) diff --git a/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_enabled_dual.py b/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_enabled_dual.py deleted file mode 100644 index e5ec7037..00000000 --- a/tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_enabled_dual.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. -import sys -import unittest - -import azure.functions as func -from tests.utils import testutils - -from azure_functions_worker import protos -from azure_functions_worker.bindings import meta - -DEFERRED_BINDINGS_ENABLED_DUAL_DIR = testutils.EXTENSION_TESTS_FOLDER / \ - 'deferred_bindings_tests' / \ - 'deferred_bindings_functions' / \ - 'deferred_bindings_enabled_dual' - - -class MockMBD: - def __init__(self, version: str, source: str, - content_type: str, content: str): - self.version = version - self.source = source - self.content_type = content_type - self.content = content - - -@unittest.skipIf(sys.version_info.minor <= 8, "The base extension" - "is only supported for 3.9+.") -class TestDeferredBindingsEnabledDual(testutils.AsyncTestCase): - - async def test_deferred_bindings_dual_metadata(self): - async with testutils.start_mockhost( - script_root=DEFERRED_BINDINGS_ENABLED_DUAL_DIR) as host: - await host.init_worker() - r = await host.get_functions_metadata() - self.assertIsInstance(r.response, protos.FunctionMetadataResponse) - self.assertEqual(r.response.result.status, - protos.StatusResult.Success) - - async def test_deferred_bindings_dual_enabled_log(self): - async with testutils.start_mockhost( - script_root=DEFERRED_BINDINGS_ENABLED_DUAL_DIR) as host: - await host.init_worker() - r = await host.get_functions_metadata() - enabled_log_present = False - for log in r.logs: - message = log.message - if "Deferred bindings enabled: True" in message: - enabled_log_present = True - break - self.assertTrue(enabled_log_present) - - -@unittest.skipIf(sys.version_info.minor <= 8, "The base extension" - "is only supported for 3.9+.") -class TestDeferredBindingsDualHelpers(testutils.AsyncTestCase): - - async def test_check_deferred_bindings_dual_enabled(self): - """ - check_deferred_bindings_enabled checks if deferred bindings is enabled at fx - and single binding level. - - The first bool represents if deferred bindings is enabled at a fx level. This - means that at least one binding in the function is a deferred binding type. - - The second represents if the current binding is deferred binding. If this is - True, then deferred bindings must also be enabled at the function level. - - Test: type is not supported, deferred_bindings_enabled already set - """ - async with testutils.start_mockhost( - script_root=DEFERRED_BINDINGS_ENABLED_DUAL_DIR) as host: - await host.init_worker() - self.assertEqual(meta.check_deferred_bindings_enabled( - func.InputStream, True), (True, False)) diff --git a/tests/unittests/test_dispatcher.py b/tests/unittests/test_dispatcher.py index 10609500..a924a734 100644 --- a/tests/unittests/test_dispatcher.py +++ b/tests/unittests/test_dispatcher.py @@ -605,6 +605,7 @@ async def test_dispatcher_functions_metadata_request(self): self.assertFalse(r.response.use_default_metadata_indexing) self.assertEqual(r.response.result.status, protos.StatusResult.Success) + del sys.modules['function_app'] async def test_dispatcher_functions_metadata_request_with_retry(self): """Test if the functions metadata response will be sent correctly @@ -617,6 +618,7 @@ async def test_dispatcher_functions_metadata_request_with_retry(self): self.assertFalse(r.response.use_default_metadata_indexing) self.assertEqual(r.response.result.status, protos.StatusResult.Success) + del sys.modules['function_app'] class TestDispatcherSteinLegacyFallback(testutils.AsyncTestCase): @@ -757,7 +759,7 @@ async def test_dispatcher_load_modules_con_app_placeholder_disabled(self): " Placeholder: False", logs) -class TestDispatcherIndexinginInit(unittest.TestCase): +class TestDispatcherIndexingInInit(unittest.TestCase): def setUp(self): self.loop = asyncio.new_event_loop() @@ -783,6 +785,8 @@ def test_worker_init_request_with_indexing_enabled(self): self.assertIsNotNone(self.dispatcher._function_metadata_result) self.assertIsNone(self.dispatcher._function_metadata_exception) + del sys.modules['function_app'] + @patch.dict(os.environ, {PYTHON_ENABLE_INIT_INDEXING: 'false'}) def test_worker_init_request_with_indexing_disabled(self): request = protos.StreamingMessage( @@ -847,6 +851,8 @@ def test_functions_metadata_request_with_init_indexing_enabled(self): self.assertIsNotNone(self.dispatcher._function_metadata_result) self.assertIsNone(self.dispatcher._function_metadata_exception) + del sys.modules['function_app'] + @patch.dict(os.environ, {PYTHON_ENABLE_INIT_INDEXING: 'false'}) def test_functions_metadata_request_with_init_indexing_disabled(self): init_request = protos.StreamingMessage( @@ -879,6 +885,8 @@ def test_functions_metadata_request_with_init_indexing_disabled(self): self.assertIsNotNone(self.dispatcher._function_metadata_result) self.assertIsNone(self.dispatcher._function_metadata_exception) + del sys.modules['function_app'] + @patch.dict(os.environ, {PYTHON_ENABLE_INIT_INDEXING: 'true'}) @patch.object(Dispatcher, 'index_functions') def test_functions_metadata_request_with_indexing_exception( @@ -941,6 +949,8 @@ def test_dispatcher_indexing_in_load_request(self): self.assertIsNotNone(self.dispatcher._function_metadata_result) self.assertIsNone(self.dispatcher._function_metadata_exception) + del sys.modules['function_app'] + @patch.dict(os.environ, {PYTHON_ENABLE_INIT_INDEXING: 'true'}) @patch.object(Dispatcher, 'index_functions') def test_dispatcher_indexing_in_load_request_with_exception(