Skip to content

Commit

Permalink
Add Python 3.13 testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrews committed Jul 10, 2024
1 parent c3e8cdb commit 55c9d94
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
- name: '3.12'
tox_env: integration-py312

- name: '3.13.0-alpha - 3.13.0'
tox_env: integration-py313

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -122,6 +125,9 @@ jobs:
- name: '3.12'
tox_env: unit-py312

- name: '3.13.0-alpha - 3.13.0'
tox_env: unit-py313

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions src/ansible_runner/utils/base64io.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ def __init__(self, wrapped: IO) -> None:
:raises TypeError: if ``wrapped`` does not have attributes needed to determine the stream's state
"""
# set before the attr check as we may reach close() after that check fails
self.__read_buffer = b""
self.__write_buffer = b""

required_attrs = ("read", "write", "close", "closed", "flush")
if not all(hasattr(wrapped, attr) for attr in required_attrs):
raise TypeError(
f"Base64IO wrapped object must have attributes: {repr(sorted(required_attrs))}"
)
super().__init__()
self.__wrapped = wrapped
self.__read_buffer = b""
self.__write_buffer = b""

def __enter__(self):
"""Return self on enter."""
Expand Down
2 changes: 2 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--pre
mypy==1.6.0
pylint==3.0.1
pytest==8.1.1
Expand All @@ -8,4 +9,5 @@ pytest-xdist==2.5.0
types-pyyaml
flake8==6.1.0
yamllint==1.32.0
cffi
cryptography
20 changes: 8 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = linters, ansible{27, 28, 29, -base}
envlist = linters
requires =
tox>4
setuptools>=64
Expand All @@ -9,21 +9,17 @@ pytest_cov_args = --cov --cov-report html --cov-report term --cov-report xml

[testenv]
description = Run tests with {basepython}
deps = ansible27: ansible<2.8
ansible28: ansible<2.9
ansible29: ansible<2.10
ansible-base: ansible-base
py{,3,39,310,311}: ansible-core
integration{,-py39,-py310,-py311,-py312}: ansible-core
build
-r {toxinidir}/test/requirements.txt
deps =
ansible-core
integration{,-py39,-py310,-py311,-py312}: build
-r {toxinidir}/test/requirements.txt
passenv =
HOME
RUNNER_TEST_IMAGE_NAME
usedevelop = True
commands = pytest -vv -n auto {posargs}

[testenv:linters{,-py39,-py310,-py311,-py312}]
[testenv:linters{,-py39,-py310,-py311,-py312,-py313}]
description = Run code linters
commands =
flake8 --version
Expand All @@ -33,11 +29,11 @@ commands =
mypy src/ansible_runner
pylint src/ansible_runner test

[testenv:unit{,-py39,-py310,-py311,-py312}]
[testenv:unit{,-py39,-py310,-py311,-py312,-py313}]
description = Run unit tests
commands = pytest -vv -n auto {posargs:test/unit} {[shared]pytest_cov_args}

[testenv:integration{,-py39,-py310,-py311,-py312}]
[testenv:integration{,-py39,-py310,-py311,-py312,-py313}]
description = Run integration tests
commands = pytest -vv -n auto {posargs:test/integration} {[shared]pytest_cov_args}

Expand Down

0 comments on commit 55c9d94

Please sign in to comment.