8000 Add testing helpers to extract warnings and deprecations from module results by felixfontein · Pull Request #85327 · ansible/ansible · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add testing helpers to extract warnings and deprecations from module results #85327

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

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

felixfontein
Copy link
Contributor
SUMMARY

Right now I have to use hacks like https://github.com/ansible-collections/community.internal_test_tools/blob/577f37c5402e0e0c352f9841ac582bd94ae7457a/tests/unit/plugins/modules/utils.py#L95-L114 to extract the warning messages, and this can break any time when internals of ansible-core change.

Ref: #85181 (comment)

ISSUE TYPE
  • Feature Pull Request
  • Test Pull Request

@ansibot ansibot added feature This issue/PR relates to a feature request. test This PR relates to tests. needs_triage Needs a first human triage before being processed. labels Jun 14, 2025
@ansibot
Copy link
Contributor
ansibot commented Jun 14, 2025

The test ansible-test sanity --test mypy [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.mypy/3.13/cfef9f44/bin/python /root/ansible/test/sanity/code-smell/mypy.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "/root/ansible/test/sanity/code-smell/mypy.py", line 235, in <module>
    main()
    ~~~~^^
  File "/root/ansible/test/sanity/code-smell/mypy.py", line 49, in main
    unfiltered_messages.extend(test_context(python_version, context, paths))
                               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/ansible/test/sanity/code-smell/mypy.py", line 163, in test_context
    raise Exception(f'{stdout=} {stderr=}')
Exception: stdout='test/units/modules/conftest.py:19:5: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]\n' stderr=''

click here for bot help

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jun 14, 2025
@felixfontein
Copy link
Contributor Author

I'm not sure how that mypy error relates to my change. It rather seems to be a bug in the mypy test runner (test/sanity/code-smell/mypy.py).

@mattclay mattclay removed the needs_triage Needs a first human triage before being processed. label Jun 14, 2025
@mattclay
Copy link
Member

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

@mattclay
Copy link
Member

I'm not sure how that mypy error relates to my change. It rather seems to be a bug in the mypy test runner (test/sanity/code-smell/mypy.py).

The mypy error was due to missing annotations, which I added in #85329. I'm not sure why that error didn't show up earlier.

@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jun 14, 2025
@felixfontein
Copy link
Contributor Author

@mattclay thanks!

@felixfontein
Copy link
Contributor Author

@mattclay @nitzmahone while this is marked as a "feature", I think it should be part of ansible-core 2.19, since the internal objects that are required to correctly parse warnings and deprecation messages are being introduced in 2.19.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0