Skip to content

Commit

Permalink
Fixed Python 3.12 comp
Browse files Browse the repository at this point in the history
- Update Python versions.
  • Loading branch information
eandersson committed Jan 21, 2024
1 parent 37cef03 commit 02bc3bb
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 13 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,47 @@
name: Publish

on:
push:
tags:
- '2.*'

jobs:
build:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6.15
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 .
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--outdir dist/
.
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 3 additions & 3 deletions amqpstorm/tests/functional/test_reliability.py
@@ -1,4 +1,4 @@
import imp
import importlib
import sys
import threading
import time
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_functional_ssl_connection_without_ssl(self):
restore_func = sys.modules['ssl']
try:
sys.modules['ssl'] = None
imp.reload(compatibility)
importlib.reload(compatibility)
self.assertIsNone(compatibility.ssl)
self.assertRaisesRegex(
AMQPConnectionError,
Expand All @@ -191,7 +191,7 @@ def test_functional_ssl_connection_without_ssl(self):
)
finally:
sys.modules['ssl'] = restore_func
imp.reload(compatibility)
importlib.reload(compatibility)

@setup(new_connection=False, queue=True)
def test_functional_verify_passive_declare(self):
Expand Down
14 changes: 7 additions & 7 deletions amqpstorm/tests/unit/test_compatibility.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import imp
import importlib
import ssl
import sys

Expand Down Expand Up @@ -126,15 +126,15 @@ def test_compatibility_ssl_not_defined(self):
restore_func = sys.modules['ssl']
try:
sys.modules['ssl'] = None
imp.reload(compatibility)
importlib.reload(compatibility)
self.assertIsNone(compatibility.ssl)
self.assertIsNone(compatibility.DEFAULT_SSL_VERSION)
self.assertFalse(compatibility.SSL_SUPPORTED)
self.assertFalse(compatibility.SSL_CERT_MAP)
self.assertFalse(compatibility.SSL_VERSIONS)
finally:
sys.modules['ssl'] = restore_func
imp.reload(compatibility)
importlib.reload(compatibility)

def test_compatibility_no_supported_ssl_version(self):
"""This tests mimics the behavior of a Python build without
Expand All @@ -147,7 +147,7 @@ def test_compatibility_no_supported_ssl_version(self):
del sys.modules['ssl'].PROTOCOL_TLSv1_2
del sys.modules['ssl'].PROTOCOL_TLSv1_1
del sys.modules['ssl'].PROTOCOL_TLSv1
imp.reload(compatibility)
importlib.reload(compatibility)
self.assertIsNone(compatibility.DEFAULT_SSL_VERSION)
self.assertFalse(compatibility.SSL_SUPPORTED)
self.assertFalse(compatibility.SSL_CERT_MAP)
Expand All @@ -156,7 +156,7 @@ def test_compatibility_no_supported_ssl_version(self):
sys.modules['ssl'].PROTOCOL_TLSv1_2 = restore_tls_v1_2
sys.modules['ssl'].PROTOCOL_TLSv1_1 = restore_tls_v1_1
sys.modules['ssl'].PROTOCOL_TLSv1 = restore_tls_v1
imp.reload(compatibility)
importlib.reload(compatibility)

def test_compatibility_only_tls_v1_supported(self):
"""This test mimics the behavior of earlier versions of Python that
Expand All @@ -167,10 +167,10 @@ def test_compatibility_only_tls_v1_supported(self):
try:
del sys.modules['ssl'].PROTOCOL_TLSv1_2
del sys.modules['ssl'].PROTOCOL_TLSv1_1
imp.reload(compatibility)
importlib.reload(compatibility)
self.assertEqual(compatibility.get_default_ssl_version(),
ssl.PROTOCOL_TLSv1)
finally:
sys.modules['ssl'].PROTOCOL_TLSv1_2 = restore_tls_v1_2
sys.modules['ssl'].PROTOCOL_TLSv1_1 = restore_tls_v1
imp.reload(compatibility)
importlib.reload(compatibility)
@@ -1,4 +1,4 @@
import imp
import importlib
import ssl
import sys

Expand Down Expand Up @@ -57,7 +57,7 @@ def test_uri_ssl_not_supported(self):
restore_func = sys.modules['ssl']
try:
sys.modules['ssl'] = None
imp.reload(compatibility)
importlib.reload(compatibility)
self.assertIsNone(compatibility.ssl)
self.assertRaisesRegex(
AMQPConnectionError,
Expand All @@ -66,4 +66,4 @@ def test_uri_ssl_not_supported(self):
)
finally:
sys.modules['ssl'] = restore_func
imp.reload(compatibility)
importlib.reload(compatibility)

0 comments on commit 02bc3bb

Please sign in to comment.