Skip to content

Commit

Permalink
Enabling Py3.11 for E2E and unit tests. (#1162)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pdthummar authored Jan 19, 2023
1 parent 02e5b12 commit 66746d6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/ci_e2e_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]

steps:
- name: Checkout code.
Expand Down Expand Up @@ -113,6 +113,18 @@ jobs:
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
- name: Running 3.11 Tests
if: matrix.python-version == 3.11
env:
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }}
AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }}
AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString311 }}
AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString311 }}
AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString311 }}
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
- name: Codecov
uses: codecov/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_ut_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion azure_functions_worker/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def format_exception(exception: Exception) -> str:
etype=type(exception),
tb=exception.__traceback__,
value=exception))
elif (sys.version_info.major, sys.version_info.minor) == (3, 10):
elif (sys.version_info.major, sys.version_info.minor) >= (3, 10):
msg += ''.join(traceback.format_exception(exception))
else:
msg = str(exception)
Expand Down
12 changes: 9 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,19 @@
]

INSTALL_REQUIRES = [
"grpcio~=1.43.0",
"grpcio-tools~=1.43.0",
"protobuf~=3.19.3",
'azure-functions==1.13.0b1',
"python-dateutil~=2.8.2"
]

if sys.version_info[:3] < (3, 11, 0):
INSTALL_REQUIRES.append("protobuf~=3.19.3")
INSTALL_REQUIRES.append("grpcio-tools~=1.43.0")
INSTALL_REQUIRES.append("grpcio~=1.43.0")
else:
INSTALL_REQUIRES.append("protobuf~=4.21.9")
INSTALL_REQUIRES.append("grpcio-tools~=1.50.0")
INSTALL_REQUIRES.append("grpcio~=1.50.0")

EXTRA_REQUIRES = {
"dev": [
"azure-eventhub~=5.7.0", # Used for EventHub E2E tests
Expand Down
4 changes: 3 additions & 1 deletion tests/unittests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,15 @@ def test_is_python_version(self):
is_python_version_38 = common.is_python_version('3.8')
is_python_version_39 = common.is_python_version('3.9')
is_python_version_310 = common.is_python_version('3.10')
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,
is_python_version_310
is_python_version_310,
is_python_version_311
]))

def test_get_sdk_from_sys_path(self):
Expand Down

0 comments on commit 66746d6

Please sign in to comment.