diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index fbece616..ccfdd4b5 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -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 diff --git a/requirements.txt b/requirements.txt index 3d97aec2..8d961408 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pylama==7.7.1 -pytest==5.2.2; python_version >= '3.0' +pytest tox==3.14.0 diff --git a/test/paho_test.py b/test/paho_test.py index 080168b4..5c393842 100644 --- a/test/paho_test.py +++ b/test/paho_test.py @@ -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 @@ -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) diff --git a/tox.ini b/tox.ini index 5d190e17..25cc72a8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39} +envlist = py{37,38,39,310,311,312} [testenv] whitelist_externals = echo make @@ -13,6 +13,8 @@ commands = ruff . pytest make -C test test +env = + PYTHONDEVMODE=1 [testenv:lint] deps =