From e3843c80634ddae639d13a331c9aa6bb609578d7 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 16 Jul 2023 12:02:09 +0100 Subject: [PATCH] Ignore a `DeprecationWarning` which is breaking the test assertions ``` DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead ``` Signed-off-by: Pedro Algarvio --- tests/pytests/functional/states/test_file.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/pytests/functional/states/test_file.py b/tests/pytests/functional/states/test_file.py index 007ce2b7fdcb..69630dcc9f47 100644 --- a/tests/pytests/functional/states/test_file.py +++ b/tests/pytests/functional/states/test_file.py @@ -7,6 +7,7 @@ import shutil import socket import sys +import warnings from contextlib import closing import pytest @@ -212,10 +213,12 @@ def test_file_symlink_replace_existing_link(states, tmp_path): old_target = tmp_path / "bar" name.symlink_to(old_target) - ret = states.file.symlink( - name=str(name), - target=str(target), - ) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=DeprecationWarning, lineno=283) + ret = states.file.symlink( + name=str(name), + target=str(target), + ) assert ret.filtered == { "name": str(name),