Skip to content

Commit 7cb3367

Browse files
SG-32806 Enable support for Python 3.10 in CI (#301)
* 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
1 parent aa6a948 commit 7cb3367

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[![VFX Platform](https://img.shields.io/badge/vfxplatform-2020-blue.svg)](http://www.vfxplatform.com/)
2-
[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/)
1+
[![VFX Platform](https://img.shields.io/badge/vfxplatform-2023%202022%202021%202020-blue.svg)](http://www.vfxplatform.com/)
2+
[![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/)
33
[![Reference Documentation](http://img.shields.io/badge/doc-reference-blue.svg)](http://developer.shotgridsoftware.com/python-api)
44
[![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)
55
[![Coverage Status](https://coveralls.io/repos/github/shotgunsoftware/python-api/badge.svg?branch=master)](https://coveralls.io/github/shotgunsoftware/python-api?branch=master)

azure-pipelines-templates/run-tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,19 @@ jobs:
4343
# matrix.
4444
strategy:
4545
matrix:
46-
# We support these two versions of Python.
46+
# We support these versions of Python.
4747
Python37:
4848
python.version: '3.7'
4949
Python39:
5050
python.version: '3.9'
51+
Python310:
52+
python.version: '3.10'
53+
# Note for Python 3.11. This will raise hundres of warnings on a third party module
54+
# pytest_nunit/nunit.py
55+
# DeprecationWarning: Use setlocale(), getencoding() and getlocale() instead
56+
# This is the current behavior on the latest 1.0.3 version of this module.
57+
58+
maxParallel: 3
5159

5260
# These are the steps that will be executed inside each job.
5361
steps:

shotgun_api3/shotgun.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4244,11 +4244,19 @@ def connect(self):
42444244
"Connect to a host on a given (SSL) port."
42454245
http_client.HTTPConnection.connect(self)
42464246
# Now that the regular HTTP socket has been created, wrap it with our SSL certs.
4247-
self.sock = ssl.wrap_socket(
4248-
self.sock,
4249-
ca_certs=self.__ca_certs,
4250-
cert_reqs=ssl.CERT_REQUIRED
4251-
)
4247+
if six.PY38:
4248+
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
4249+
context.verify_mode = ssl.CERT_REQUIRED
4250+
context.check_hostname = False
4251+
if self.__ca_certs:
4252+
context.load_verify_locations(self.__ca_certs)
4253+
self.sock = context.wrap_socket(self.sock)
4254+
else:
4255+
self.sock = ssl.wrap_socket(
4256+
self.sock,
4257+
ca_certs=self.__ca_certs,
4258+
cert_reqs=ssl.CERT_REQUIRED
4259+
)
42524260

42534261

42544262
class CACertsHTTPSHandler(urllib.request.HTTPSHandler):

0 commit comments

Comments
 (0)