forked from ansible/ansible
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable-2.16] Update default test container Python to 3.12 and suppor…
…t for PyLint 3.0.1 (ansible#81953) * temporary PyLint plugin to mask 3.12 finalizer noise * ansible-test - Default to Python 3.12 for base/default * ansible-test - Update pylint requirements * ansible-test - Remove obsoleted changelog entry * Add changelog fragment for pylint work-around. (cherry picked from commit d8484f0) Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
- Loading branch information
1 parent
9c91e57
commit 04ba3da
Showing
7 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bugfixes: | ||
- ansible-test - Update ``pylint`` to version 3.0.1. | ||
- ansible-test - Include missing ``pylint`` requirements for Python 3.10. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- ansible-test - Add a ``pylint`` plugin to work around a known issue on Python 3.12. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- ansible-test - Make Python 3.12 the default version used in the ``base`` and ``default`` containers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
test/lib/ansible_test/_util/controller/sanity/pylint/plugins/hide_unraisable.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Temporary plugin to prevent stdout noise pollution from finalization of abandoned generators under Python 3.12""" | ||
from __future__ import annotations | ||
|
||
import sys | ||
import typing as t | ||
|
||
if t.TYPE_CHECKING: | ||
from pylint.lint import PyLinter | ||
|
||
|
||
def _mask_finalizer_valueerror(ur: t.Any) -> None: | ||
"""Mask only ValueErrors from finalizing abandoned generators; delegate everything else""" | ||
# work around Py3.12 finalizer changes that sometimes spews this error message to stdout | ||
# see https://github.com/pylint-dev/pylint/issues/9138 | ||
if ur.exc_type is ValueError and 'generator already executing' in str(ur.exc_value): | ||
return | ||
|
||
sys.__unraisablehook__(ur) | ||
|
||
|
||
def register(linter: PyLinter) -> None: # pylint: disable=unused-argument | ||
"""PyLint plugin registration entrypoint""" | ||
if sys.version_info >= (3, 12): | ||
sys.unraisablehook = _mask_finalizer_valueerror |