ansible-test - Update sanity tests and default Python (#83998)

* ansible-test - Update sanity test requirements
* ansible-test - Default to Python 3.13 in base/default containers
* ansible-test - Fix incorrect AnyStr type hints
pull/84048/head
Matt Clay 1 year ago committed by GitHub
parent d6d2251929
commit 9406ed3109
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,3 @@
minor_changes:
- ansible-test - Update ``pylint`` sanity test to use version 3.3.1.
- ansible-test - Default to Python 3.13 in the ``base`` and ``default`` containers.

@ -1,6 +1,6 @@
base image=quay.io/ansible/base-test-container:7.5.0 python=3.12,3.8,3.9,3.10,3.11,3.13
default image=quay.io/ansible/default-test-container:10.5.0 python=3.12,3.8,3.9,3.10,3.11,3.13 context=collection
default image=quay.io/ansible/ansible-core-test-container:10.5.0 python=3.12,3.8,3.9,3.10,3.11,3.13 context=ansible-core
base image=quay.io/ansible/base-test-container:7.5.0 python=3.13,3.8,3.9,3.10,3.11,3.12
default image=quay.io/ansible/default-test-container:10.5.0 python=3.13,3.8,3.9,3.10,3.11,3.12 context=collection
default image=quay.io/ansible/ansible-core-test-container:10.5.0 python=3.13,3.8,3.9,3.10,3.11,3.12 context=ansible-core
alpine320 image=quay.io/ansible/alpine320-test-container:8.1.0 python=3.12 cgroup=none audit=none
fedora40 image=quay.io/ansible/fedora40-test-container:8.1.0 python=3.12
ubuntu2204 image=quay.io/ansible/ubuntu2204-test-container:8.1.0 python=3.10

@ -1,9 +1,9 @@
# edit "sanity.pylint.in" and generate with: hacking/update-sanity-requirements.py --test pylint
astroid==3.2.4
dill==0.3.8
astroid==3.3.4
dill==0.3.9
isort==5.13.2
mccabe==0.7.0
platformdirs==4.3.2
pylint==3.2.7
platformdirs==4.3.6
pylint==3.3.1
PyYAML==6.0.2
tomlkit==0.13.2

@ -6,17 +6,17 @@ import typing as t
ENCODING = 'utf-8'
def to_optional_bytes(value: t.Optional[t.AnyStr], errors: str = 'strict') -> t.Optional[bytes]:
def to_optional_bytes(value: t.Optional[str | bytes], errors: str = 'strict') -> t.Optional[bytes]:
"""Return the given value as bytes encoded using UTF-8 if not already bytes, or None if the value is None."""
return None if value is None else to_bytes(value, errors)
def to_optional_text(value: t.Optional[t.AnyStr], errors: str = 'strict') -> t.Optional[str]:
def to_optional_text(value: t.Optional[str | bytes], errors: str = 'strict') -> t.Optional[str]:
"""Return the given value as text decoded using UTF-8 if not already text, or None if the value is None."""
return None if value is None else to_text(value, errors)
def to_bytes(value: t.AnyStr, errors: str = 'strict') -> bytes:
def to_bytes(value: str | bytes, errors: str = 'strict') -> bytes:
"""Return the given value as bytes encoded using UTF-8 if not already bytes."""
if isinstance(value, bytes):
return value
@ -27,7 +27,7 @@ def to_bytes(value: t.AnyStr, errors: str = 'strict') -> bytes:
raise Exception('value is not bytes or text: %s' % type(value))
def to_text(value: t.AnyStr, errors: str = 'strict') -> str:
def to_text(value: str | bytes, errors: str = 'strict') -> str:
"""Return the given value as text decoded using UTF-8 if not already text."""
if isinstance(value, bytes):
return value.decode(ENCODING, errors)

@ -20,6 +20,7 @@ disable=
too-many-nested-blocks,
too-many-return-statements,
too-many-statements,
too-many-positional-arguments,
use-dict-literal, # ignoring as a common style issue
useless-return, # complains about returning None when the return type is optional

@ -18,6 +18,7 @@ disable=
too-many-nested-blocks,
too-many-return-statements,
too-many-statements,
too-many-positional-arguments,
use-dict-literal, # ignoring as a common style issue
unspecified-encoding, # always run with UTF-8 encoding enforced
useless-return, # complains about returning None when the return type is optional

@ -17,6 +17,7 @@ disable=
too-many-nested-blocks,
too-many-return-statements,
too-many-statements,
too-many-positional-arguments,
use-dict-literal, # ignoring as a common style issue
unspecified-encoding, # always run with UTF-8 encoding enforced
useless-return, # complains about returning None when the return type is optional

@ -98,6 +98,7 @@ disable=
too-many-public-methods,
too-many-return-statements,
too-many-statements,
too-many-positional-arguments,
try-except-raise,
unbalanced-tuple-unpacking,
undefined-loop-variable,

@ -91,6 +91,7 @@ disable=
too-many-public-methods,
too-many-return-statements,
too-many-statements,
too-many-positional-arguments,
try-except-raise,
unbalanced-tuple-unpacking,
undefined-loop-variable,

@ -363,17 +363,17 @@ def open_binary_file(path, mode='rb'): # type: (str, str) -> t.IO[bytes]
return io.open(to_bytes(path), mode) # pylint: disable=consider-using-with,unspecified-encoding
def to_optional_bytes(value, errors='strict'): # type: (t.Optional[t.AnyStr], str) -> t.Optional[bytes]
def to_optional_bytes(value, errors='strict'): # type: (t.Optional[str | bytes], str) -> t.Optional[bytes]
"""Return the given value as bytes encoded using UTF-8 if not already bytes, or None if the value is None."""
return None if value is None else to_bytes(value, errors)
def to_optional_text(value, errors='strict'): # type: (t.Optional[t.AnyStr], str) -> t.Optional[t.Text]
def to_optional_text(value, errors='strict'): # type: (t.Optional[str | bytes], str) -> t.Optional[t.Text]
"""Return the given value as text decoded using UTF-8 if not already text, or None if the value is None."""
return None if value is None else to_text(value, errors)
def to_bytes(value, errors='strict'): # type: (t.AnyStr, str) -> bytes
def to_bytes(value, errors='strict'): # type: (str | bytes, str) -> bytes
"""Return the given value as bytes encoded using UTF-8 if not already bytes."""
if isinstance(value, bytes):
return value
@ -384,7 +384,7 @@ def to_bytes(value, errors='strict'): # type: (t.AnyStr, str) -> bytes
raise Exception('value is not bytes or text: %s' % type(value))
def to_text(value, errors='strict'): # type: (t.AnyStr, str) -> t.Text
def to_text(value, errors='strict'): # type: (str | bytes, str) -> t.Text
"""Return the given value as text decoded using UTF-8 if not already text."""
if isinstance(value, bytes):
return value.decode(ENCODING, errors)

@ -7,12 +7,12 @@ mypy==1.11.2
mypy-extensions==1.0.0
packaging==24.1
pycparser==2.22
tomli==2.0.1
tomli==2.0.2
types-backports==0.1.3
types-paramiko==3.4.0.20240423
types-PyYAML==6.0.12.20240808
types-requests==2.32.0.20240907
types-setuptools==74.1.0.20240907
types-paramiko==3.5.0.20240928
types-PyYAML==6.0.12.20240917
types-requests==2.32.0.20240914
types-setuptools==75.1.0.20240917
types-toml==0.10.8.20240310
typing_extensions==4.12.2
urllib3==2.2.2
urllib3==2.2.3

@ -1,4 +1,4 @@
# edit "package-data.requirements.in" and generate with: hacking/update-sanity-requirements.py --test package-data
build==1.2.2
packaging==24.1
pyproject_hooks==1.1.0
pyproject_hooks==1.2.0

@ -3,7 +3,7 @@ application_properties==0.8.2
Columnar==1.4.1
pymarkdownlnt==0.9.23
PyYAML==6.0.2
tomli==2.0.1
tomli==2.0.2
toolz==0.12.1
typing_extensions==4.12.2
wcwidth==0.2.13

Loading…
Cancel
Save