Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.13 testing #1379

Merged
merged 4 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Shrews marked this conversation as resolved.
Show resolved Hide resolved
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'
Shrews marked this conversation as resolved.
Show resolved Hide resolved
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: 1 addition & 1 deletion test/integration/test_transmit_worker_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_keepalive_setting(self, tmp_path, project_fixtures, keepalive_setting):
pytest.fail(f'unparseable JSON in output (likely corrupted by keepalive): {line}')
else:
# account for some wobble in the number of keepalives for artifact gather, etc
assert 1 <= incoming_data.count('"event": "keepalive"') < 5
assert 1 <= incoming_data.count('"event": "keepalive"') < 15

@pytest.mark.parametrize("job_type", ['run', 'adhoc'])
def test_remote_job_by_sockets(self, tmp_path, project_fixtures, job_type):
Expand Down
2 changes: 2 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ pytest-xdist==2.5.0
types-pyyaml
flake8==6.1.0
yamllint==1.32.0
# cffi pre-release to make cryptography work with python 3.13 (remove when 3.13 is released)
cffi==1.17.0rc1
Shrews marked this conversation as resolved.
Show resolved Hide resolved
cryptography
17 changes: 9 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ 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
py{,3,39,310,311,312,313}: ansible-core
integration{,-py39,-py310,-py311,-py312,-py313}: ansible-core
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,13 +33,14 @@ 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}
commands =
pytest -vv -n auto {posargs:test/integration} {[shared]pytest_cov_args}

[testenv:docs]
description = Build documentation
Expand Down
Loading