summaryrefslogtreecommitdiffstats
path: root/test/units/galaxy
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2024-10-08 22:29:37 +0200
committerGitHub <noreply@github.com>2024-10-08 22:29:37 +0200
commit955e310b4c33112b6eb261590c925d16da4ca965 (patch)
treecd872d6270056fdbfc0adcfc950474fbdafbe4a5 /test/units/galaxy
parentUpdate unique filter docs (#84078) (diff)
downloadansible-955e310b4c33112b6eb261590c925d16da4ca965.tar.xz
ansible-955e310b4c33112b6eb261590c925d16da4ca965.zip
Cover unit tests with mypy (#84084)
* Added support for testing unit tests with mypy. * Added support for ignoring individual mypy error codes. * Added missing assert on unit tests and marked xfail. * Added type hints for some unit tests. * Added ignores for unit tests not passing mypy. * Fixed incorrect autouse argument in unit test fixtures. * Fixed minor issues causing problems with mypy in unit tests.
Diffstat (limited to 'test/units/galaxy')
-rw-r--r--test/units/galaxy/test_api.py2
-rw-r--r--test/units/galaxy/test_collection.py2
-rw-r--r--test/units/galaxy/test_collection_install.py6
-rw-r--r--test/units/galaxy/test_role_install.py2
4 files changed, 5 insertions, 7 deletions
diff --git a/test/units/galaxy/test_api.py b/test/units/galaxy/test_api.py
index 6acd165b1d..2ef1d07325 100644
--- a/test/units/galaxy/test_api.py
+++ b/test/units/galaxy/test_api.py
@@ -29,7 +29,7 @@ from ansible.utils import context_objects as co
from ansible.utils.display import Display
-@pytest.fixture(autouse='function')
+@pytest.fixture(autouse=True)
def reset_cli_args():
co.GlobalCLIArgs._Singleton__instance = None
# Required to initialise the GalaxyAPI object
diff --git a/test/units/galaxy/test_collection.py b/test/units/galaxy/test_collection.py
index bfabd81d9e..73e915dee6 100644
--- a/test/units/galaxy/test_collection.py
+++ b/test/units/galaxy/test_collection.py
@@ -31,7 +31,7 @@ from ansible.utils.display import Display
from ansible.utils.hashing import secure_hash_s
-@pytest.fixture(autouse='function')
+@pytest.fixture(autouse=True)
def reset_cli_args():
co.GlobalCLIArgs._Singleton__instance = None
yield
diff --git a/test/units/galaxy/test_collection_install.py b/test/units/galaxy/test_collection_install.py
index 6559535f93..dc6dbe5b6f 100644
--- a/test/units/galaxy/test_collection_install.py
+++ b/test/units/galaxy/test_collection_install.py
@@ -53,7 +53,7 @@ def call_galaxy_cli(args):
co.GlobalCLIArgs._Singleton__instance = orig
-@pytest.fixture(autouse='function')
+@pytest.fixture(autouse=True)
def reset_cli_args():
co.GlobalCLIArgs._Singleton__instance = None
yield
@@ -992,9 +992,7 @@ def test_install_collection_with_no_dependency(collection_artifact, monkeypatch)
(["good_signature", "good_signature"], '2', [], True),
]
)
-def test_verify_file_signatures(signatures, required_successful_count, ignore_errors, expected_success):
- # type: (List[bool], int, bool, bool) -> None
-
+def test_verify_file_signatures(signatures: list[str], required_successful_count: str, ignore_errors: list[str], expected_success: bool) -> None:
def gpg_error_generator(results):
for result in results:
if isinstance(result, collection.gpg.GpgBaseError):
diff --git a/test/units/galaxy/test_role_install.py b/test/units/galaxy/test_role_install.py
index 25dff80cd6..8e77352a30 100644
--- a/test/units/galaxy/test_role_install.py
+++ b/test/units/galaxy/test_role_install.py
@@ -28,7 +28,7 @@ def call_galaxy_cli(args):
co.GlobalCLIArgs._Singleton__instance = orig
-@pytest.fixture(autouse='function')
+@pytest.fixture(autouse=True)
def reset_cli_args():
co.GlobalCLIArgs._Singleton__instance = None
yield