Skip to content

Commit

Permalink
Merge pull request #771 from akx/test-on-newer-pythons
Browse files Browse the repository at this point in the history
CI: Test on newer Pythons; enable Python dev mode
  • Loading branch information
PierreF authored Dec 23, 2023
2 parents a7ef5e4 + 88c8e72 commit 3d26fa6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
python: [3.7, 3.8, 3.9]
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: |
tox.ini
setup.py
- run: pip install tox
- if: matrix.python == '3.7'
run: TOXENV=py37 tox
- if: matrix.python == '3.8'
run: TOXENV=py38 tox
- if: matrix.python == '3.9'
run: TOXENV=py39 tox
- run: tox -e py
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pylama==7.7.1
pytest==5.2.2; python_version >= '3.0'
pytest
tox==3.14.0
13 changes: 8 additions & 5 deletions test/paho_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create_server_socket():
return sock


def create_server_socket_ssl(*args, **kwargs):
def create_server_socket_ssl(cert_reqs=None):
if ssl is None:
raise RuntimeError

Expand All @@ -46,10 +46,13 @@ def create_server_socket_ssl(*args, **kwargs):

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
ssock = ssl.wrap_socket(
sock, ca_certs="../ssl/all-ca.crt",
keyfile="../ssl/server.key", certfile="../ssl/server.crt",
server_side=True, ssl_version=ssl_version, **kwargs)
context = ssl.SSLContext(ssl_version)
context.load_verify_locations("../ssl/all-ca.crt")
context.load_cert_chain("../ssl/server.crt", "../ssl/server.key")
if cert_reqs:
context.verify_mode = cert_reqs

ssock = context.wrap_socket(sock, server_side=True)
ssock.settimeout(10)
ssock.bind(('', 1888))
ssock.listen(5)
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{37,38,39}
envlist = py{37,38,39,310,311,312}

[testenv]
whitelist_externals = echo make
Expand All @@ -13,6 +13,8 @@ commands =
ruff .
pytest
make -C test test
env =
PYTHONDEVMODE=1

[testenv:lint]
deps =
Expand Down

0 comments on commit 3d26fa6

Please sign in to comment.