From 5487e9e4fd77ac7542072e4ade8fc50e894d29a3 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 6 May 2021 14:53:50 -0700 Subject: [PATCH] Update runtime-metadata sanity test for Python 3.10. --- .../ansible-test-sanity-runtime-metadata.yml | 2 ++ .../_data/sanity/code-smell/runtime-metadata.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 changelogs/fragments/ansible-test-sanity-runtime-metadata.yml diff --git a/changelogs/fragments/ansible-test-sanity-runtime-metadata.yml b/changelogs/fragments/ansible-test-sanity-runtime-metadata.yml new file mode 100644 index 00000000000..a15fca2a6e4 --- /dev/null +++ b/changelogs/fragments/ansible-test-sanity-runtime-metadata.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - Update the ``runtime-metadata`` sanity test to handle a new warning on Python 3.10. diff --git a/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py b/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py index 53ea00fc5ae..29b4ac4bfa7 100755 --- a/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py +++ b/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py @@ -7,6 +7,18 @@ import datetime import os import re import sys +import warnings + +# Temporary solution for the PEP 632 deprecation warning on Python 3.10. +# This should be removed once distutils.version has been vendored in ansible.module_utils. +# See: https://github.com/ansible/ansible/issues/74599 +# pylint: disable=wrong-import-position +warnings.filterwarnings( + 'ignore', + 'The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives', + DeprecationWarning, +) + from distutils.version import StrictVersion, LooseVersion from functools import partial