From 47ee0e5fe63d1a45c133b2df4bd207a6d7ca70e9 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Sat, 12 Feb 2022 01:30:23 +0000 Subject: [PATCH] Drop usage of distutils and use 'packaging' for version comparison ansible-core also depends on packaging so this seems like a reasonable dependency --- requirements.txt | 1 + test/conftest.py | 4 ++-- test/integration/test_display_callback.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 99995ce35..09cf067a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ pexpect>=4.5 +packaging python-daemon pyyaml six diff --git a/test/conftest.py b/test/conftest.py index 2ba0ae8e3..558dc24b3 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,7 +1,7 @@ import shutil from pathlib import Path -from distutils.version import LooseVersion +from packaging.version import Version import subprocess from ansible_runner import defaults @@ -60,7 +60,7 @@ def is_pre_ansible212(): .stdout.strip() .decode() ) - if LooseVersion(base_version) < LooseVersion("2.12"): + if Version(base_version) < Version("2.12"): return True except pkg_resources.DistributionNotFound: pass diff --git a/test/integration/test_display_callback.py b/test/integration/test_display_callback.py index f150fc3ad..5d05d71fc 100644 --- a/test/integration/test_display_callback.py +++ b/test/integration/test_display_callback.py @@ -197,6 +197,7 @@ def test_callback_plugin_task_args_leak(executor, playbook): # make sure playbook was successful, so all tasks were hit assert not events[-1]['event_data']['failures'], 'Unexpected playbook execution failure' + @pytest.mark.parametrize( "playbook", [