Skip to content

Commit 66746d6

Browse files
authored
Enabling Py3.11 for E2E and unit tests. (#1162)
* Testing e2e and unittests for py3.11 * Updating file to use format_traceback's change of signature for 3.11 * Updated unittest to check python version for 3.11 * Reverted protobuf and grpcio version for py3.10
1 parent 02e5b12 commit 66746d6

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

.github/workflows/ci_e2e_workflow.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
24+
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
2525

2626
steps:
2727
- name: Checkout code.
@@ -113,6 +113,18 @@ jobs:
113113
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }}
114114
run: |
115115
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
116+
- name: Running 3.11 Tests
117+
if: matrix.python-version == 3.11
118+
env:
119+
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }}
120+
AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }}
121+
AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString311 }}
122+
AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString311 }}
123+
AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString311 }}
124+
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }}
125+
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }}
126+
run: |
127+
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
116128
- name: Codecov
117129
uses: codecov/[email protected]
118130
with:

.github/workflows/ci_ut_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
23+
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
2424
steps:
2525
- uses: actions/checkout@v2
2626
- name: Set up Python ${{ matrix.python-version }}

azure_functions_worker/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def format_exception(exception: Exception) -> str:
2828
etype=type(exception),
2929
tb=exception.__traceback__,
3030
value=exception))
31-
elif (sys.version_info.major, sys.version_info.minor) == (3, 10):
31+
elif (sys.version_info.major, sys.version_info.minor) >= (3, 10):
3232
msg += ''.join(traceback.format_exception(exception))
3333
else:
3434
msg = str(exception)

setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,19 @@
106106
]
107107

108108
INSTALL_REQUIRES = [
109-
"grpcio~=1.43.0",
110-
"grpcio-tools~=1.43.0",
111-
"protobuf~=3.19.3",
112109
'azure-functions==1.13.0b1',
113110
"python-dateutil~=2.8.2"
114111
]
115112

113+
if sys.version_info[:3] < (3, 11, 0):
114+
INSTALL_REQUIRES.append("protobuf~=3.19.3")
115+
INSTALL_REQUIRES.append("grpcio-tools~=1.43.0")
116+
INSTALL_REQUIRES.append("grpcio~=1.43.0")
117+
else:
118+
INSTALL_REQUIRES.append("protobuf~=4.21.9")
119+
INSTALL_REQUIRES.append("grpcio-tools~=1.50.0")
120+
INSTALL_REQUIRES.append("grpcio~=1.50.0")
121+
116122
EXTRA_REQUIRES = {
117123
"dev": [
118124
"azure-eventhub~=5.7.0", # Used for EventHub E2E tests

tests/unittests/test_utilities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,15 @@ def test_is_python_version(self):
318318
is_python_version_38 = common.is_python_version('3.8')
319319
is_python_version_39 = common.is_python_version('3.9')
320320
is_python_version_310 = common.is_python_version('3.10')
321+
is_python_version_311 = common.is_python_version('3.11')
321322

322323
self.assertTrue(any([
323324
is_python_version_36,
324325
is_python_version_37,
325326
is_python_version_38,
326327
is_python_version_39,
327-
is_python_version_310
328+
is_python_version_310,
329+
is_python_version_311
328330
]))
329331

330332
def test_get_sdk_from_sys_path(self):

0 commit comments

Comments
 (0)