diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 9cbb6b86d..42a316605 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
- // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
+ // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.9",
diff --git a/azure_functions_worker/_thirdparty/aio_compat.py b/azure_functions_worker/_thirdparty/aio_compat.py
deleted file mode 100644
index f4a28bb60..000000000
--- a/azure_functions_worker/_thirdparty/aio_compat.py
+++ /dev/null
@@ -1,87 +0,0 @@
-"""Backport of asyncio.run() function from Python 3.7.
-
-Source: https://github.com/python/cpython/blob/
- bd093355a6aaf2f4ca3ed153e195da57870a55eb/Lib/asyncio/runners.py
-"""
-
-
-import asyncio
-
-
-def get_running_loop():
- """Return the running event loop. Raise a RuntimeError if there is none.
-
- This function is thread-specific.
- """
- loop = asyncio._get_running_loop()
- if loop is None:
- raise RuntimeError('no running event loop')
- return loop
-
-
-def run(main, *, debug=False):
- """Run a coroutine.
-
- This function runs the passed coroutine, taking care of
- managing the asyncio event loop and finalizing asynchronous
- generators.
-
- This function cannot be called when another asyncio event loop is
- running in the same thread.
-
- If debug is True, the event loop will be run in debug mode.
- This function always creates a new event loop and closes it at the end.
-
- It should be used as a main entry point for asyncio programs, and should
- ideally only be called once.
- """
- if asyncio._get_running_loop() is not None:
- raise RuntimeError(
- "asyncio.run() cannot be called from a running event loop")
-
- if not asyncio.iscoroutine(main):
- raise ValueError("a coroutine was expected, got {!r}".format(main))
-
- loop = asyncio.new_event_loop()
- try:
- asyncio.set_event_loop(loop)
- loop.set_debug(debug)
- return loop.run_until_complete(main)
- finally:
- try:
- _cancel_all_tasks(loop)
- loop.run_until_complete(loop.shutdown_asyncgens())
- finally:
- asyncio.set_event_loop(None)
- loop.close()
-
-
-def _cancel_all_tasks(loop):
- to_cancel = [task for task in asyncio.Task.all_tasks(loop)
- if not task.done()]
- if not to_cancel:
- return
-
- for task in to_cancel:
- task.cancel()
-
- loop.run_until_complete(
- asyncio.gather(*to_cancel, loop=loop, return_exceptions=True))
-
- for task in to_cancel:
- if task.cancelled():
- continue
- if task.exception() is not None:
- loop.call_exception_handler({
- 'message': 'unhandled exception during asyncio.run() shutdown',
- 'exception': task.exception(),
- 'task': task,
- })
-
-
-try:
- # Try to import the 'run' function from asyncio.
- from asyncio import run, get_running_loop # NoQA
-except ImportError:
- # Python <= 3.6
- pass
diff --git a/azure_functions_worker/dispatcher.py b/azure_functions_worker/dispatcher.py
index 70d33894a..cb4cd8120 100644
--- a/azure_functions_worker/dispatcher.py
+++ b/azure_functions_worker/dispatcher.py
@@ -45,14 +45,6 @@
_TRUE = "true"
-"""In Python 3.6, the current_task method was in the Task class, but got moved
-out in 3.7+ and fully removed in 3.9. Thus, to support 3.6 and 3.9 together, we
-need to switch the implementation of current_task for 3.6.
-"""
-_CURRENT_TASK = asyncio.Task.current_task \
- if (sys.version_info[0] == 3 and sys.version_info[1] == 6) \
- else asyncio.current_task
-
class DispatcherMeta(type):
__current_dispatcher__ = None
@@ -446,7 +438,7 @@ async def _handle__invocation_request(self, request):
# Set the current `invocation_id` to the current task so
# that our logging handler can find it.
- current_task = _CURRENT_TASK(self._loop)
+ current_task = asyncio.current_task(self._loop)
assert isinstance(current_task, ContextEnabledTask)
current_task.set_azure_invocation_id(invocation_id)
@@ -860,7 +852,7 @@ class ContextEnabledTask(asyncio.Task):
def __init__(self, coro, loop):
super().__init__(coro, loop=loop)
- current_task = _CURRENT_TASK(loop)
+ current_task = asyncio.current_task(loop)
if current_task is not None:
invocation_id = getattr(
current_task, self.AZURE_INVOCATION_ID, None)
@@ -874,7 +866,7 @@ def set_azure_invocation_id(self, invocation_id: str) -> None:
def get_current_invocation_id() -> Optional[str]:
loop = asyncio._get_running_loop()
if loop is not None:
- current_task = _CURRENT_TASK(loop)
+ current_task = asyncio.current_task(loop)
if current_task is not None:
task_invocation_id = getattr(current_task,
ContextEnabledTask.AZURE_INVOCATION_ID,
diff --git a/azure_functions_worker/main.py b/azure_functions_worker/main.py
index 4e1f70a77..3e5845a93 100644
--- a/azure_functions_worker/main.py
+++ b/azure_functions_worker/main.py
@@ -45,8 +45,8 @@ def main():
DependencyManager.initialize()
DependencyManager.use_worker_dependencies()
+ import asyncio
from . import logging
- from ._thirdparty import aio_compat
from .logging import error_logger, logger, format_exception
args = parse_args()
@@ -57,7 +57,7 @@ def main():
args.worker_id, args.request_id, args.host, args.port)
try:
- return aio_compat.run(start_async(
+ return asyncio.run(start_async(
args.host, args.port, args.worker_id, args.request_id))
except Exception as ex:
error_logger.exception(
diff --git a/azure_functions_worker/utils/dependency.py b/azure_functions_worker/utils/dependency.py
index c3455aa06..2c92d8171 100644
--- a/azure_functions_worker/utils/dependency.py
+++ b/azure_functions_worker/utils/dependency.py
@@ -35,20 +35,20 @@ class DependencyManager:
Linux Consumption sys.path: [
"/tmp/functions\\standby\\wwwroot", # Placeholder folder
"/home/site/wwwroot/.python_packages/lib/site-packages", # CX's deps
- "/azure-functions-host/workers/python/3.6/LINUX/X64", # Worker's deps
+ "/azure-functions-host/workers/python/3.11/LINUX/X64", # Worker's deps
"/home/site/wwwroot" # CX's Working Directory
]
Linux Dedicated/Premium sys.path: [
"/home/site/wwwroot", # CX's Working Directory
"/home/site/wwwroot/.python_packages/lib/site-packages", # CX's deps
- "/azure-functions-host/workers/python/3.6/LINUX/X64", # Worker's deps
+ "/azure-functions-host/workers/python/3.11/LINUX/X64", # Worker's deps
]
Core Tools sys.path: [
"%appdata%\\azure-functions-core-tools\\bin\\workers\\"
- "python\\3.6\\WINDOWS\\X64", # Worker's deps
- "C:\\Users\\user\\Project\\.venv38\\lib\\site-packages", # CX's deps
+ "python\\3.11\\WINDOWS\\X64", # Worker's deps
+ "C:\\Users\\user\\Project\\.venv311\\lib\\site-packages", # CX's deps
"C:\\Users\\user\\Project", # CX's Working Directory
]
diff --git a/docs/index.rst b/docs/index.rst
index e0da09b1f..d6f0e8e1f 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -9,7 +9,7 @@ Azure Functions for Python
Requirements
============
-Azure Functions for Python support Python 3.6 or later.
+Azure Functions for Python support Python 3.7 or later.
Programming Model
diff --git a/pack/Microsoft.Azure.Functions.V2.PythonWorker.nuspec b/pack/Microsoft.Azure.Functions.V2.PythonWorker.nuspec
deleted file mode 100644
index b8b5eea53..000000000
--- a/pack/Microsoft.Azure.Functions.V2.PythonWorker.nuspec
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Microsoft.Azure.Functions.PythonWorker
- 1.0.0
- Microsoft
- Microsoft
- false
- Microsoft Azure Functions Python Worker
- © .NET Foundation. All rights reserved.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pack/Microsoft.Azure.Functions.V3.PythonWorker.nuspec b/pack/Microsoft.Azure.Functions.V3.PythonWorker.nuspec
deleted file mode 100644
index 06add8a27..000000000
--- a/pack/Microsoft.Azure.Functions.V3.PythonWorker.nuspec
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
- Microsoft.Azure.Functions.PythonWorker
- 1.1.0
- Microsoft
- Microsoft
- false
- Microsoft Azure Functions Python Worker
- © .NET Foundation. All rights reserved.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/python/prodV2/worker.config.json b/python/prodV2/worker.config.json
deleted file mode 100644
index 81045cc12..000000000
--- a/python/prodV2/worker.config.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "description":{
- "language":"python",
- "defaultRuntimeVersion":"3.6",
- "supportedOperatingSystems":["LINUX", "OSX", "WINDOWS"],
- "supportedRuntimeVersions":["3.6", "3.7"],
- "supportedArchitectures":["X64", "X86"],
- "extensions":[".py"],
- "defaultExecutablePath":"python",
- "defaultWorkerPath":"%FUNCTIONS_WORKER_RUNTIME_VERSION%/{os}/{architecture}/worker.py"
- }
-}
diff --git a/python/prodV2/worker.py b/python/prodV2/worker.py
deleted file mode 100644
index 3b6b90882..000000000
--- a/python/prodV2/worker.py
+++ /dev/null
@@ -1,86 +0,0 @@
-import os
-import sys
-
-from pathlib import Path
-
-# User packages
-PKGS_PATH = "site/wwwroot/.python_packages"
-VENV_PKGS_PATH = "site/wwwroot/worker_venv"
-
-PKGS_36 = "lib/python3.6/site-packages"
-PKGS = "lib/site-packages"
-
-# Azure environment variables
-AZURE_WEBSITE_INSTANCE_ID = "WEBSITE_INSTANCE_ID"
-AZURE_CONTAINER_NAME = "CONTAINER_NAME"
-AZURE_WEBJOBS_SCRIPT_ROOT = "AzureWebJobsScriptRoot"
-
-
-def is_azure_environment():
- """Check if the function app is running on the cloud"""
- return (AZURE_CONTAINER_NAME in os.environ
- or AZURE_WEBSITE_INSTANCE_ID in os.environ)
-
-
-def add_script_root_to_sys_path():
- """Append function project root to module finding sys.path"""
- functions_script_root = os.getenv(AZURE_WEBJOBS_SCRIPT_ROOT)
- if functions_script_root is not None:
- sys.path.append(functions_script_root)
-
-
-def determine_user_pkg_paths():
- """This finds the user packages when function apps are running on the cloud
-
- For Python 3.6 app, the third-party packages can live in any of the paths:
- /home/site/wwwroot/.python_packages/lib/site-packages
- /home/site/wwwroot/.python_packages/lib/python3.6/site-packages
- /home/site/wwwroot/worker_venv/lib/python3.6/site-packages
-
- For Python 3.7, we only accept:
- /home/site/wwwroot/.python_packages/lib/site-packages
- """
- minor_version = sys.version_info[1]
-
- home = Path.home()
- pkgs_path = os.path.join(home, PKGS_PATH)
- venv_pkgs_path = os.path.join(home, VENV_PKGS_PATH)
-
- user_pkg_paths = []
- if minor_version == 6:
- user_pkg_paths.append(os.path.join(venv_pkgs_path, PKGS_36))
- user_pkg_paths.append(os.path.join(pkgs_path, PKGS_36))
- user_pkg_paths.append(os.path.join(pkgs_path, PKGS))
- elif minor_version == 7:
- user_pkg_paths.append(os.path.join(pkgs_path, PKGS))
- else:
- raise RuntimeError(f'Unsupported Python version: 3.{minor_version}')
-
- return user_pkg_paths
-
-
-if __name__ == '__main__':
- # worker.py lives in the same directory as azure_functions_worker
- func_worker_dir = str(Path(__file__).absolute().parent)
- env = os.environ
-
- if is_azure_environment():
- user_pkg_paths = determine_user_pkg_paths()
-
- joined_pkg_paths = os.pathsep.join(user_pkg_paths)
-
- # On cloud, we prioritize third-party user packages
- # over worker packages in PYTHONPATH
- env['PYTHONPATH'] = f'{joined_pkg_paths}:{func_worker_dir}'
- os.execve(sys.executable,
- [sys.executable, '-m', 'azure_functions_worker']
- + sys.argv[1:],
- env)
- else:
- # On local development, we prioritize worker packages over
- # third-party user packages (in .venv)
- sys.path.insert(1, func_worker_dir)
- add_script_root_to_sys_path()
- from azure_functions_worker import main
-
- main.main()
diff --git a/python/prodV3/worker.config.json b/python/prodV3/worker.config.json
deleted file mode 100644
index f935fd394..000000000
--- a/python/prodV3/worker.config.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "description":{
- "language":"python",
- "defaultRuntimeVersion":"3.8",
- "supportedOperatingSystems":["LINUX", "OSX", "WINDOWS"],
- "supportedRuntimeVersions":["3.6", "3.7", "3.8", "3.9"],
- "supportedArchitectures":["X64", "X86"],
- "extensions":[".py"],
- "defaultExecutablePath":"python",
- "defaultWorkerPath":"%FUNCTIONS_WORKER_RUNTIME_VERSION%/{os}/{architecture}/worker.py"
- }
-}
diff --git a/python/prodV3/worker.py b/python/prodV3/worker.py
deleted file mode 100644
index a3006b6fa..000000000
--- a/python/prodV3/worker.py
+++ /dev/null
@@ -1,86 +0,0 @@
-import os
-import sys
-
-from pathlib import Path
-
-# User packages
-PKGS_PATH = "site/wwwroot/.python_packages"
-VENV_PKGS_PATH = "site/wwwroot/worker_venv"
-
-PKGS_36 = "lib/python3.6/site-packages"
-PKGS = "lib/site-packages"
-
-# Azure environment variables
-AZURE_WEBSITE_INSTANCE_ID = "WEBSITE_INSTANCE_ID"
-AZURE_CONTAINER_NAME = "CONTAINER_NAME"
-AZURE_WEBJOBS_SCRIPT_ROOT = "AzureWebJobsScriptRoot"
-
-
-def is_azure_environment():
- """Check if the function app is running on the cloud"""
- return (AZURE_CONTAINER_NAME in os.environ
- or AZURE_WEBSITE_INSTANCE_ID in os.environ)
-
-
-def add_script_root_to_sys_path():
- """Append function project root to module finding sys.path"""
- functions_script_root = os.getenv(AZURE_WEBJOBS_SCRIPT_ROOT)
- if functions_script_root is not None:
- sys.path.append(functions_script_root)
-
-
-def determine_user_pkg_paths():
- """This finds the user packages when function apps are running on the cloud
-
- For Python 3.6 app, the third-party packages can live in any of the paths:
- /home/site/wwwroot/.python_packages/lib/site-packages
- /home/site/wwwroot/.python_packages/lib/python3.6/site-packages
- /home/site/wwwroot/worker_venv/lib/python3.6/site-packages
-
- For Python 3.7 and Python 3.8, we only accept:
- /home/site/wwwroot/.python_packages/lib/site-packages
- """
- minor_version = sys.version_info[1]
-
- home = Path.home()
- pkgs_path = os.path.join(home, PKGS_PATH)
- venv_pkgs_path = os.path.join(home, VENV_PKGS_PATH)
-
- user_pkg_paths = []
- if minor_version == 6:
- user_pkg_paths.append(os.path.join(venv_pkgs_path, PKGS_36))
- user_pkg_paths.append(os.path.join(pkgs_path, PKGS_36))
- user_pkg_paths.append(os.path.join(pkgs_path, PKGS))
- elif minor_version in (7, 8, 9):
- user_pkg_paths.append(os.path.join(pkgs_path, PKGS))
- else:
- raise RuntimeError(f'Unsupported Python version: 3.{minor_version}')
-
- return user_pkg_paths
-
-
-if __name__ == '__main__':
- # worker.py lives in the same directory as azure_functions_worker
- func_worker_dir = str(Path(__file__).absolute().parent)
- env = os.environ
-
- if is_azure_environment():
- user_pkg_paths = determine_user_pkg_paths()
-
- joined_pkg_paths = os.pathsep.join(user_pkg_paths)
-
- # On cloud, we prioritize third-party user packages
- # over worker packages in PYTHONPATH
- env['PYTHONPATH'] = f'{joined_pkg_paths}:{func_worker_dir}'
- os.execve(sys.executable,
- [sys.executable, '-m', 'azure_functions_worker']
- + sys.argv[1:],
- env)
- else:
- # On local development, we prioritize worker packages over
- # third-party user packages (in .venv)
- sys.path.insert(1, func_worker_dir)
- add_script_root_to_sys_path()
- from azure_functions_worker import main
-
- main.main()
diff --git a/setup.cfg b/setup.cfg
index c0f3ff71e..b323ebf19 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -13,11 +13,8 @@ warn_return_any = True
disallow_subclassing_any = False
ignore_missing_imports = True
-[mypy-azure_functions_worker._thirdparty.aio_compat]
-ignore_errors = True
-
[mypy-azure_functions_worker.protos.*]
ignore_errors = True
[mypy-azure_functions_worker._thirdparty.typing_inspect]
-ignore_errors = True
+ignore_errors = True
\ No newline at end of file
diff --git a/tests/unittests/test_dispatcher.py b/tests/unittests/test_dispatcher.py
index d607216ed..1f183c6d3 100644
--- a/tests/unittests/test_dispatcher.py
+++ b/tests/unittests/test_dispatcher.py
@@ -28,10 +28,6 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
Python 3.7 and extended classes change this value and other platform
specific values to test the behavior across the different python versions.
- - Why not python 3.6?
- - In Azure.Functions (library), the typing_inspect module imports specific
- modules which are not available on systems where Python 3.7+ is installed.
-
Ref:
NEW_TYPING = sys.version_info[:3] >= (3, 7, 0) # PEP 560
"""
diff --git a/tests/unittests/test_extension.py b/tests/unittests/test_extension.py
index 13140c0b6..c0b390f3f 100644
--- a/tests/unittests/test_extension.py
+++ b/tests/unittests/test_extension.py
@@ -1,5 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
+import asyncio
import importlib
import logging
import os
@@ -9,7 +10,6 @@
from importlib import import_module
from unittest.mock import patch, Mock, call
-from azure_functions_worker._thirdparty import aio_compat
from azure_functions_worker.constants import PYTHON_ENABLE_WORKER_EXTENSIONS, \
CUSTOMER_PACKAGES_PATH
from azure_functions_worker.extension import (
@@ -578,7 +578,7 @@ def test_get_async_invocation_wrapper_no_extension(self):
the customer's function.
"""
# Create a mocked customer_function with async wrapper
- result = aio_compat.run(
+ result = asyncio.run(
self._instance.get_async_invocation_wrapper(
self._mock_context,
self._mock_function_main_async,
@@ -602,7 +602,7 @@ def test_get_async_invocation_wrapper_with_func_extension(self):
_func_ext_instance = FuncExtClass()
# Create a mocked customer_function with async wrapper
- result = aio_compat.run(
+ result = asyncio.run(
self._instance.get_async_invocation_wrapper(
self._mock_context,
self._mock_function_main_async,
@@ -631,7 +631,7 @@ def test_get_invocation_async_disabled_with_flag(self):
_func_ext_instance = FuncExtClass()
# Create a mocked customer_function with async wrapper
- result = aio_compat.run(
+ result = asyncio.run(
self._instance.get_async_invocation_wrapper(
self._mock_context,
self._mock_function_main_async,
diff --git a/tests/unittests/test_utilities.py b/tests/unittests/test_utilities.py
index 3ea0900ba..10e7ada5d 100644
--- a/tests/unittests/test_utilities.py
+++ b/tests/unittests/test_utilities.py
@@ -315,7 +315,6 @@ def parse_int_no_raise(value: str):
def test_is_python_version(self):
# Should pass at least 1 test
- is_python_version_36 = common.is_python_version('3.6')
is_python_version_37 = common.is_python_version('3.7')
is_python_version_38 = common.is_python_version('3.8')
is_python_version_39 = common.is_python_version('3.9')
@@ -323,7 +322,6 @@ def test_is_python_version(self):
is_python_version_311 = common.is_python_version('3.11')
self.assertTrue(any([
- is_python_version_36,
is_python_version_37,
is_python_version_38,
is_python_version_39,
diff --git a/tests/unittests/test_utilities_dependency.py b/tests/unittests/test_utilities_dependency.py
index ba635b0be..1f32ca7c4 100644
--- a/tests/unittests/test_utilities_dependency.py
+++ b/tests/unittests/test_utilities_dependency.py
@@ -57,7 +57,7 @@ def test_initialize_in_linux_consumption(self):
sys.path.extend([
'/tmp/functions\\standby\\wwwroot',
'/home/site/wwwroot/.python_packages/lib/site-packages',
- '/azure-functions-host/workers/python/3.6/LINUX/X64',
+ '/azure-functions-host/workers/python/3.11/LINUX/X64',
'/home/site/wwwroot'
])
DependencyManager.initialize()
@@ -71,7 +71,7 @@ def test_initialize_in_linux_consumption(self):
)
self.assertEqual(
DependencyManager.worker_deps_path,
- '/azure-functions-host/workers/python/3.6/LINUX/X64'
+ '/azure-functions-host/workers/python/3.11/LINUX/X64'
)
def test_initialize_in_linux_dedicated(self):
@@ -79,7 +79,7 @@ def test_initialize_in_linux_dedicated(self):
sys.path.extend([
'/home/site/wwwroot',
'/home/site/wwwroot/.python_packages/lib/site-packages',
- '/azure-functions-host/workers/python/3.7/LINUX/X64'
+ '/azure-functions-host/workers/python/3.11/LINUX/X64'
])
DependencyManager.initialize()
self.assertEqual(
@@ -92,7 +92,7 @@ def test_initialize_in_linux_dedicated(self):
)
self.assertEqual(
DependencyManager.worker_deps_path,
- '/azure-functions-host/workers/python/3.7/LINUX/X64'
+ '/azure-functions-host/workers/python/3.11/LINUX/X64'
)
def test_initialize_in_windows_core_tools(self):
@@ -100,7 +100,7 @@ def test_initialize_in_windows_core_tools(self):
sys.path.extend([
'C:\\Users\\user\\AppData\\Roaming\\npm\\'
'node_modules\\azure-functions-core-tools\\bin\\'
- 'workers\\python\\3.6\\WINDOWS\\X64',
+ 'workers\\python\\3.11\\WINDOWS\\X64',
'C:\\FunctionApp\\.venv38\\lib\\site-packages',
'C:\\FunctionApp'
])
@@ -116,7 +116,7 @@ def test_initialize_in_windows_core_tools(self):
self.assertEqual(
DependencyManager.worker_deps_path,
'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\'
- 'azure-functions-core-tools\\bin\\workers\\python\\3.6\\WINDOWS'
+ 'azure-functions-core-tools\\bin\\workers\\python\\3.11\\WINDOWS'
'\\X64'
)
@@ -129,15 +129,6 @@ def test_get_cx_deps_path_in_script_root_no_sys_path(self):
result = DependencyManager._get_cx_deps_path()
self.assertEqual(result, '')
- def test_get_cx_deps_path_in_script_root_with_sys_path_linux_py36(self):
- # Test for Python 3.6 Azure Environment
- sys.path.append('/home/site/wwwroot/.python_packages/sites/lib/'
- 'python3.6/site-packages/')
- os.environ['AzureWebJobsScriptRoot'] = '/home/site/wwwroot'
- result = DependencyManager._get_cx_deps_path()
- self.assertEqual(result, '/home/site/wwwroot/.python_packages/sites/'
- 'lib/python3.6/site-packages/')
-
def test_get_cx_deps_path_in_script_root_with_sys_path_linux(self):
# Test for Python 3.7+ Azure Environment
sys.path.append('/home/site/wwwroot/.python_packages/sites/lib/'
@@ -185,19 +176,19 @@ def test_get_worker_deps_path_from_windows_core_tools(self):
# Test for Windows Core Tools Environment
sys.path.append('C:\\Users\\user\\AppData\\Roaming\\npm\\'
'node_modules\\azure-functions-core-tools\\bin\\'
- 'workers\\python\\3.6\\WINDOWS\\X64')
+ 'workers\\python\\3.11\\WINDOWS\\X64')
result = DependencyManager._get_worker_deps_path()
self.assertEqual(result,
'C:\\Users\\user\\AppData\\Roaming\\npm\\'
'node_modules\\azure-functions-core-tools\\bin\\'
- 'workers\\python\\3.6\\WINDOWS\\X64')
+ 'workers\\python\\3.11\\WINDOWS\\X64')
def test_get_worker_deps_path_from_linux_azure_environment(self):
# Test for Azure Environment
- sys.path.append('/azure-functions-host/workers/python/3.7/LINUX/X64')
+ sys.path.append('/azure-functions-host/workers/python/3.11/LINUX/X64')
result = DependencyManager._get_worker_deps_path()
self.assertEqual(result,
- '/azure-functions-host/workers/python/3.7/LINUX/X64')
+ '/azure-functions-host/workers/python/3.11/LINUX/X64')
@patch('azure_functions_worker.utils.dependency.importlib.util')
def test_get_worker_deps_path_without_worker_path(self, mock):
diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py
index c4f1fe66e..b0326cfb2 100644
--- a/tests/utils/testutils.py
+++ b/tests/utils/testutils.py
@@ -36,7 +36,6 @@
from azure_functions_worker import dispatcher
from azure_functions_worker import protos
-from azure_functions_worker._thirdparty import aio_compat
from azure_functions_worker.bindings.shared_memory_data_transfer \
import FileAccessorFactory
from azure_functions_worker.bindings.shared_memory_data_transfer \
@@ -147,7 +146,7 @@ def __new__(mcls, name, bases, ns):
def _sync_wrap(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
- return aio_compat.run(func(*args, **kwargs))
+ return asyncio.run(func(*args, **kwargs))
return wrapper
@@ -737,7 +736,7 @@ def __init__(self, scripts_dir: pathlib.PurePath):
self._worker: typing.Optional[dispatcher.Dispatcher] = None
async def __aenter__(self) -> _MockWebHost:
- loop = aio_compat.get_running_loop()
+ loop = asyncio.get_running_loop()
self._host = _MockWebHost(loop, self._scripts_dir)
await self._host.start()
diff --git a/tests/utils/testutils_lc.py b/tests/utils/testutils_lc.py
index 68598e7dd..87d2f8e49 100644
--- a/tests/utils/testutils_lc.py
+++ b/tests/utils/testutils_lc.py
@@ -118,11 +118,7 @@ def _find_latest_mesh_image(cls,
return cls._mesh_images[host_major]
# match 3.1.3
- regex = re.compile(host_major + r'.\d+.\d+')
-
- # match 3.1.3-python3.x
- if python_version != '3.6':
- regex = re.compile(host_major + r'.\d+.\d+-python' + python_version)
+ regex = re.compile(host_major + r'.\d+.\d+-python' + python_version)
response = requests.get(_MESH_IMAGE_URL, allow_redirects=True)
if not response.ok: