From b872b6f21d14ff10c221d84217eb568318e9ad8b Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Tue, 25 Jun 2024 14:54:01 +0530 Subject: `vyos.vyos` is no longer deprecated! 🎉 (#348) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove deprecation notice for vyos.vyos Signed-off-by: NilashishC * Add changelog Signed-off-by: NilashishC * fix review comments Signed-off-by: NilashishC * chore: auto fixes from pre-commit.com hooks --------- Signed-off-by: NilashishC Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- tests/unit/mock/loader.py | 1 + tests/unit/mock/path.py | 2 ++ tests/unit/mock/procenv.py | 2 ++ tests/unit/mock/vault_helper.py | 1 + tests/unit/mock/yaml_helper.py | 10 ++++++++-- 5 files changed, 14 insertions(+), 2 deletions(-) (limited to 'tests/unit/mock') diff --git a/tests/unit/mock/loader.py b/tests/unit/mock/loader.py index 2828f38e..67b84c62 100644 --- a/tests/unit/mock/loader.py +++ b/tests/unit/mock/loader.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type import os diff --git a/tests/unit/mock/path.py b/tests/unit/mock/path.py index 3962f24f..1f1b7f0a 100644 --- a/tests/unit/mock/path.py +++ b/tests/unit/mock/path.py @@ -1,8 +1,10 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type from ansible.utils.path import unfrackpath from ansible_collections.vyos.vyos.tests.unit.compat.mock import MagicMock + mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x) diff --git a/tests/unit/mock/procenv.py b/tests/unit/mock/procenv.py index 06987e31..d7f3dc95 100644 --- a/tests/unit/mock/procenv.py +++ b/tests/unit/mock/procenv.py @@ -19,10 +19,12 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type import json import sys + from contextlib import contextmanager from io import BytesIO, StringIO diff --git a/tests/unit/mock/vault_helper.py b/tests/unit/mock/vault_helper.py index 4c6c890c..6006ba96 100644 --- a/tests/unit/mock/vault_helper.py +++ b/tests/unit/mock/vault_helper.py @@ -14,6 +14,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from ansible.module_utils._text import to_bytes diff --git a/tests/unit/mock/yaml_helper.py b/tests/unit/mock/yaml_helper.py index 540055d2..2e857592 100644 --- a/tests/unit/mock/yaml_helper.py +++ b/tests/unit/mock/yaml_helper.py @@ -1,9 +1,11 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type import io import yaml + from ansible.module_utils.six import PY3 from ansible.parsing.yaml.dumper import AnsibleDumper from ansible.parsing.yaml.loader import AnsibleLoader @@ -115,10 +117,14 @@ class YamlTestUtils(object): yaml_string_obj_from_string = yaml.dump(obj_from_string, Dumper=AnsibleDumper) else: yaml_string_obj_from_stream = yaml.dump( - obj_from_stream, Dumper=AnsibleDumper, encoding=None + obj_from_stream, + Dumper=AnsibleDumper, + encoding=None, ) yaml_string_obj_from_string = yaml.dump( - obj_from_string, Dumper=AnsibleDumper, encoding=None + obj_from_string, + Dumper=AnsibleDumper, + encoding=None, ) assert yaml_string == yaml_string_obj_from_stream -- cgit v1.2.3