Skip to content

Commit

Permalink
SG-32806 Enable support for Python 3.10 in CI (#301)
Browse files Browse the repository at this point in the history
* Test CI with Python 3.10

* Add Support for SSLContext

* Update badges and docs

* Remove 3.11. See note in run-tests.yml

* Update badge. Update maxParallel
  • Loading branch information
carlos-villavicencio-adsk authored Sep 22, 2023
1 parent aa6a948 commit 7cb3367
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![VFX Platform](https://img.shields.io/badge/vfxplatform-2020-blue.svg)](http://www.vfxplatform.com/)
[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/)
[![VFX Platform](https://img.shields.io/badge/vfxplatform-2023%202022%202021%202020-blue.svg)](http://www.vfxplatform.com/)
[![Python 3.7 3.9 3.10](https://img.shields.io/badge/python-3.7%20%7C%203.9%20%7C%203.10-blue.svg)](https://www.python.org/)
[![Reference Documentation](http://img.shields.io/badge/doc-reference-blue.svg)](http://developer.shotgridsoftware.com/python-api)
[![Build Status](https://dev.azure.com/shotgun-ecosystem/Python%20API/_apis/build/status/shotgunsoftware.python-api?branchName=master)](https://dev.azure.com/shotgun-ecosystem/Python%20API/_build/latest?definitionId=108&branchName=master)
[![Coverage Status](https://coveralls.io/repos/github/shotgunsoftware/python-api/badge.svg?branch=master)](https://coveralls.io/github/shotgunsoftware/python-api?branch=master)
Expand Down
10 changes: 9 additions & 1 deletion azure-pipelines-templates/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,19 @@ jobs:
# matrix.
strategy:
matrix:
# We support these two versions of Python.
# We support these versions of Python.
Python37:
python.version: '3.7'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
# Note for Python 3.11. This will raise hundres of warnings on a third party module
# pytest_nunit/nunit.py
# DeprecationWarning: Use setlocale(), getencoding() and getlocale() instead
# This is the current behavior on the latest 1.0.3 version of this module.

maxParallel: 3

# These are the steps that will be executed inside each job.
steps:
Expand Down
18 changes: 13 additions & 5 deletions shotgun_api3/shotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -4244,11 +4244,19 @@ def connect(self):
"Connect to a host on a given (SSL) port."
http_client.HTTPConnection.connect(self)
# Now that the regular HTTP socket has been created, wrap it with our SSL certs.
self.sock = ssl.wrap_socket(
self.sock,
ca_certs=self.__ca_certs,
cert_reqs=ssl.CERT_REQUIRED
)
if six.PY38:
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.verify_mode = ssl.CERT_REQUIRED
context.check_hostname = False
if self.__ca_certs:
context.load_verify_locations(self.__ca_certs)
self.sock = context.wrap_socket(self.sock)
else:
self.sock = ssl.wrap_socket(
self.sock,
ca_certs=self.__ca_certs,
cert_reqs=ssl.CERT_REQUIRED
)


class CACertsHTTPSHandler(urllib.request.HTTPSHandler):
Expand Down

0 comments on commit 7cb3367

Please sign in to comment.