From e3dae0b64682561c5d1ada587a45172a99409818 Mon Sep 17 00:00:00 2001
From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com>
Date: Sat, 15 Feb 2025 08:25:27 +0100
Subject: [PATCH] [PR #9736/8e324881 backport][stable-10] rename test helper
 (#9745)

rename test helper (#9736)

* rename test helper

* update ignore lines

(cherry picked from commit 8e324881a665e1afabadfeaadbc1a49f324c6096)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
---
 tests/sanity/ignore-2.17.txt                              | 2 +-
 tests/sanity/ignore-2.18.txt                              | 2 +-
 tests/sanity/ignore-2.19.txt                              | 2 +-
 tests/unit/plugins/modules/test_cpanm.py                  | 4 ++--
 tests/unit/plugins/modules/test_django_check.py           | 4 ++--
 tests/unit/plugins/modules/test_django_command.py         | 4 ++--
 .../unit/plugins/modules/test_django_createcachetable.py  | 4 ++--
 tests/unit/plugins/modules/test_facter_facts.py           | 4 ++--
 tests/unit/plugins/modules/test_gconftool2.py             | 4 ++--
 tests/unit/plugins/modules/test_gconftool2_info.py        | 4 ++--
 tests/unit/plugins/modules/test_gio_mime.py               | 4 ++--
 tests/unit/plugins/modules/test_krb_ticket.py             | 4 ++--
 tests/unit/plugins/modules/test_opkg.py                   | 4 ++--
 tests/unit/plugins/modules/test_puppet.py                 | 4 ++--
 tests/unit/plugins/modules/test_snap.py                   | 4 ++--
 tests/unit/plugins/modules/test_xfconf.py                 | 4 ++--
 tests/unit/plugins/modules/test_xfconf_info.py            | 4 ++--
 tests/unit/plugins/modules/{helper.py => uthelper.py}     | 8 ++++----
 18 files changed, 35 insertions(+), 35 deletions(-)
 rename tests/unit/plugins/modules/{helper.py => uthelper.py} (96%)

diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt
index 39048d2718..97751e5a92 100644
--- a/tests/sanity/ignore-2.17.txt
+++ b/tests/sanity/ignore-2.17.txt
@@ -10,5 +10,5 @@ plugins/modules/udm_user.py import-3.11  # Uses deprecated stdlib library 'crypt
 plugins/modules/udm_user.py import-3.12  # Uses deprecated stdlib library 'crypt'
 plugins/modules/xfconf.py validate-modules:return-syntax-error
 plugins/module_utils/univention_umc.py pylint:use-yield-from  # suggested construct does not work with Python 2
-tests/unit/plugins/modules/helper.py pylint:use-yield-from  # suggested construct does not work with Python 2
+tests/unit/plugins/modules/uthelper.py pylint:use-yield-from  # suggested construct does not work with Python 2
 tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt
index 39048d2718..97751e5a92 100644
--- a/tests/sanity/ignore-2.18.txt
+++ b/tests/sanity/ignore-2.18.txt
@@ -10,5 +10,5 @@ plugins/modules/udm_user.py import-3.11  # Uses deprecated stdlib library 'crypt
 plugins/modules/udm_user.py import-3.12  # Uses deprecated stdlib library 'crypt'
 plugins/modules/xfconf.py validate-modules:return-syntax-error
 plugins/module_utils/univention_umc.py pylint:use-yield-from  # suggested construct does not work with Python 2
-tests/unit/plugins/modules/helper.py pylint:use-yield-from  # suggested construct does not work with Python 2
+tests/unit/plugins/modules/uthelper.py pylint:use-yield-from  # suggested construct does not work with Python 2
 tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
diff --git a/tests/sanity/ignore-2.19.txt b/tests/sanity/ignore-2.19.txt
index 39048d2718..97751e5a92 100644
--- a/tests/sanity/ignore-2.19.txt
+++ b/tests/sanity/ignore-2.19.txt
@@ -10,5 +10,5 @@ plugins/modules/udm_user.py import-3.11  # Uses deprecated stdlib library 'crypt
 plugins/modules/udm_user.py import-3.12  # Uses deprecated stdlib library 'crypt'
 plugins/modules/xfconf.py validate-modules:return-syntax-error
 plugins/module_utils/univention_umc.py pylint:use-yield-from  # suggested construct does not work with Python 2
-tests/unit/plugins/modules/helper.py pylint:use-yield-from  # suggested construct does not work with Python 2
+tests/unit/plugins/modules/uthelper.py pylint:use-yield-from  # suggested construct does not work with Python 2
 tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
diff --git a/tests/unit/plugins/modules/test_cpanm.py b/tests/unit/plugins/modules/test_cpanm.py
index ec8e9d0f7a..a5df9158da 100644
--- a/tests/unit/plugins/modules/test_cpanm.py
+++ b/tests/unit/plugins/modules/test_cpanm.py
@@ -14,7 +14,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import cpanm
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(cpanm, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(cpanm, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_django_check.py b/tests/unit/plugins/modules/test_django_check.py
index e65b8454d9..1562dbe8ea 100644
--- a/tests/unit/plugins/modules/test_django_check.py
+++ b/tests/unit/plugins/modules/test_django_check.py
@@ -7,7 +7,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import django_check
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(django_check, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(django_check, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_django_command.py b/tests/unit/plugins/modules/test_django_command.py
index f26c05498e..3be2e475d8 100644
--- a/tests/unit/plugins/modules/test_django_command.py
+++ b/tests/unit/plugins/modules/test_django_command.py
@@ -7,7 +7,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import django_command
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(django_command, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(django_command, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_django_createcachetable.py b/tests/unit/plugins/modules/test_django_createcachetable.py
index 6da0720d82..3ed574e949 100644
--- a/tests/unit/plugins/modules/test_django_createcachetable.py
+++ b/tests/unit/plugins/modules/test_django_createcachetable.py
@@ -7,7 +7,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import django_createcachetable
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(django_createcachetable, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(django_createcachetable, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_facter_facts.py b/tests/unit/plugins/modules/test_facter_facts.py
index 8d0896226b..7b2b94f08b 100644
--- a/tests/unit/plugins/modules/test_facter_facts.py
+++ b/tests/unit/plugins/modules/test_facter_facts.py
@@ -8,7 +8,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import facter_facts
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(facter_facts, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(facter_facts, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_gconftool2.py b/tests/unit/plugins/modules/test_gconftool2.py
index 52698c5969..ed140bd3e7 100644
--- a/tests/unit/plugins/modules/test_gconftool2.py
+++ b/tests/unit/plugins/modules/test_gconftool2.py
@@ -8,7 +8,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import gconftool2
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(gconftool2, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(gconftool2, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_gconftool2_info.py b/tests/unit/plugins/modules/test_gconftool2_info.py
index 362f33e49a..6cbba8dbc0 100644
--- a/tests/unit/plugins/modules/test_gconftool2_info.py
+++ b/tests/unit/plugins/modules/test_gconftool2_info.py
@@ -8,7 +8,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import gconftool2_info
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(gconftool2_info, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(gconftool2_info, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_gio_mime.py b/tests/unit/plugins/modules/test_gio_mime.py
index 24bac3de93..180890cc39 100644
--- a/tests/unit/plugins/modules/test_gio_mime.py
+++ b/tests/unit/plugins/modules/test_gio_mime.py
@@ -8,7 +8,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import gio_mime
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(gio_mime, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(gio_mime, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_krb_ticket.py b/tests/unit/plugins/modules/test_krb_ticket.py
index 68e73159c9..99c97a4f03 100644
--- a/tests/unit/plugins/modules/test_krb_ticket.py
+++ b/tests/unit/plugins/modules/test_krb_ticket.py
@@ -8,7 +8,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import krb_ticket
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(krb_ticket, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(krb_ticket, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_opkg.py b/tests/unit/plugins/modules/test_opkg.py
index cdc93ee887..dad3a8d3f1 100644
--- a/tests/unit/plugins/modules/test_opkg.py
+++ b/tests/unit/plugins/modules/test_opkg.py
@@ -8,7 +8,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import opkg
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(opkg, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(opkg, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_puppet.py b/tests/unit/plugins/modules/test_puppet.py
index d7c8f1bd0b..7a1a231693 100644
--- a/tests/unit/plugins/modules/test_puppet.py
+++ b/tests/unit/plugins/modules/test_puppet.py
@@ -14,7 +14,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import puppet
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(puppet, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(puppet, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_snap.py b/tests/unit/plugins/modules/test_snap.py
index c63b85e0a5..e1897be5f2 100644
--- a/tests/unit/plugins/modules/test_snap.py
+++ b/tests/unit/plugins/modules/test_snap.py
@@ -9,7 +9,7 @@ __metaclass__ = type
 import sys
 
 from ansible_collections.community.general.plugins.modules import snap
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
 issue_6803_status_out = """Name    Version      Rev    Tracking         Publisher    Notes
@@ -501,4 +501,4 @@ TEST_SPEC = dict(
     ]
 )
 
-Helper.from_spec(snap, sys.modules[__name__], TEST_SPEC, mocks=[RunCommandMock])
+UTHelper.from_spec(snap, sys.modules[__name__], TEST_SPEC, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_xfconf.py b/tests/unit/plugins/modules/test_xfconf.py
index 550345b112..ea89fb93fe 100644
--- a/tests/unit/plugins/modules/test_xfconf.py
+++ b/tests/unit/plugins/modules/test_xfconf.py
@@ -14,7 +14,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import xfconf
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(xfconf, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(xfconf, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/test_xfconf_info.py b/tests/unit/plugins/modules/test_xfconf_info.py
index 4cdb92b305..d65e7035cf 100644
--- a/tests/unit/plugins/modules/test_xfconf_info.py
+++ b/tests/unit/plugins/modules/test_xfconf_info.py
@@ -7,7 +7,7 @@ __metaclass__ = type
 
 
 from ansible_collections.community.general.plugins.modules import xfconf_info
-from .helper import Helper, RunCommandMock
+from .uthelper import UTHelper, RunCommandMock
 
 
-Helper.from_module(xfconf_info, __name__, mocks=[RunCommandMock])
+UTHelper.from_module(xfconf_info, __name__, mocks=[RunCommandMock])
diff --git a/tests/unit/plugins/modules/helper.py b/tests/unit/plugins/modules/uthelper.py
similarity index 96%
rename from tests/unit/plugins/modules/helper.py
rename to tests/unit/plugins/modules/uthelper.py
index 026da9644d..ceb1d5f620 100644
--- a/tests/unit/plugins/modules/helper.py
+++ b/tests/unit/plugins/modules/uthelper.py
@@ -14,18 +14,18 @@ import yaml
 import pytest
 
 
-class Helper(object):
+class UTHelper(object):
     TEST_SPEC_VALID_SECTIONS = ["anchors", "test_cases"]
 
     @staticmethod
     def from_spec(ansible_module, test_module, test_spec, mocks=None):
-        helper = Helper(ansible_module, test_module, test_spec=test_spec, mocks=mocks)
+        helper = UTHelper(ansible_module, test_module, test_spec=test_spec, mocks=mocks)
         return helper
 
     @staticmethod
     def from_file(ansible_module, test_module, test_spec_filehandle, mocks=None):
         test_spec = yaml.safe_load(test_spec_filehandle)
-        return Helper.from_spec(ansible_module, test_module, test_spec, mocks)
+        return UTHelper.from_spec(ansible_module, test_module, test_spec, mocks)
 
     # @TODO: calculate the test_module_name automatically, remove one more parameter
     @staticmethod
@@ -36,7 +36,7 @@ class Helper(object):
             test_spec_filename = test_module.__file__.replace('.py', ext)
             if os.path.exists(test_spec_filename):
                 with open(test_spec_filename, "r") as test_spec_filehandle:
-                    return Helper.from_file(ansible_module, test_module, test_spec_filehandle, mocks=mocks)
+                    return UTHelper.from_file(ansible_module, test_module, test_spec_filehandle, mocks=mocks)
 
         raise Exception("Cannot find test case file for {0} with one of the extensions: {1}".format(test_module.__file__, extensions))