From 5a81eab17dd416eb4de693ffbcb463cae19b3b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Thu, 22 Aug 2024 16:44:19 +0200 Subject: [PATCH] artifacts: rename type to artifacts_type in get_artifacts_list ...to avoid shadowing global `type()`. --- pytest_mh/_private/artifacts.py | 14 +++++++------- pytest_mh/_private/multihost.py | 20 ++++++++++---------- pytest_mh/_private/topology_controller.py | 8 ++++---- pytest_mh/utils/coredumpd.py | 6 +++--- pytest_mh/utils/journald.py | 6 +++--- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pytest_mh/_private/artifacts.py b/pytest_mh/_private/artifacts.py index a906260..b9c702a 100644 --- a/pytest_mh/_private/artifacts.py +++ b/pytest_mh/_private/artifacts.py @@ -149,7 +149,7 @@ class MultihostArtifactsCollectable(Protocol): Protocol: object supports artifacts collection. """ - def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) -> set[str]: + def get_artifacts_list(self, host: MultihostHost, artifacts_type: MultihostArtifactsType) -> set[str]: """ Return the list of artifacts to collect. @@ -160,8 +160,8 @@ def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) :param host: Host where the artifacts are being collected. :type host: MultihostHost - :param type: Type of artifacts that are being collected. - :type type: MultihostArtifactsType + :param artifacts_type: Type of artifacts that are being collected. + :type artifacts_type: MultihostArtifactsType :return: List of artifacts to collect. :rtype: set[str] """ @@ -212,7 +212,7 @@ def should_collect(self, outcome: MultihostOutcome) -> bool: def collect( self, - type: MultihostArtifactsType, + artifacts_type: MultihostArtifactsType, *, path: str, outcome: MultihostOutcome, @@ -221,8 +221,8 @@ def collect( """ Collect artifacts to $artifacts_dir/$path/$collection_path. - :param type: Artifacts type. - :type type: MultihostArtifactsType + :param artifacts_type: Artifacts type. + :type artifacts_type: MultihostArtifactsType :param path: Artifacts path relative to artifacts directory. :type path: str :param outcome: Test or operation outcome. @@ -245,7 +245,7 @@ def collect( artifacts_set: set[str] = set() for obj in collect_objects: try: - artifacts_set.update(obj.get_artifacts_list(self.host, type)) + artifacts_set.update(obj.get_artifacts_list(self.host, artifacts_type)) except Exception as e: errors.append(e) diff --git a/pytest_mh/_private/multihost.py b/pytest_mh/_private/multihost.py index 3e0c02e..bcba567 100644 --- a/pytest_mh/_private/multihost.py +++ b/pytest_mh/_private/multihost.py @@ -589,7 +589,7 @@ def teardown(self) -> None: """ pass - def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) -> set[str]: + def get_artifacts_list(self, host: MultihostHost, artifacts_type: MultihostArtifactsType) -> set[str]: """ Return the list of artifacts to collect. @@ -600,12 +600,12 @@ def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) :param host: Host where the artifacts are being collected. :type host: MultihostHost - :param type: Type of artifacts that are being collected. - :type type: MultihostArtifactsType + :param artifacts_type: Type of artifacts that are being collected. + :type artifacts_type: MultihostArtifactsType :return: List of artifacts to collect. :rtype: set[str] """ - return self.configured_artifacts.get(type) | self.artifacts.get(type) + return self.configured_artifacts.get(artifacts_type) | self.artifacts.get(artifacts_type) def get_connection(self, shell: Shell) -> Connection: """ @@ -688,7 +688,7 @@ def teardown(self) -> None: """ pass - def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) -> set[str]: + def get_artifacts_list(self, host: MultihostHost, artifacts_type: MultihostArtifactsType) -> set[str]: """ Return the list of artifacts to collect. @@ -699,8 +699,8 @@ def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) :param host: Host where the artifacts are being collected. :type host: MultihostHost - :param type: Type of artifacts that are being collected. - :type type: MultihostArtifactsType + :param artifacts_type: Type of artifacts that are being collected. + :type artifacts_type: MultihostArtifactsType :return: List of artifacts to collect. :rtype: set[str] """ @@ -784,7 +784,7 @@ def teardown(self) -> None: """ pass - def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) -> set[str]: + def get_artifacts_list(self, host: MultihostHost, artifacts_type: MultihostArtifactsType) -> set[str]: """ Return the list of artifacts to collect. @@ -795,8 +795,8 @@ def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) :param host: Host where the artifacts are being collected. :type host: MultihostHost - :param type: Type of artifacts that are being collected. - :type type: MultihostArtifactsType + :param artifacts_type: Type of artifacts that are being collected. + :type artifacts_type: MultihostArtifactsType :return: List of artifacts to collect. :rtype: set[str] """ diff --git a/pytest_mh/_private/topology_controller.py b/pytest_mh/_private/topology_controller.py index 334d113..300942c 100644 --- a/pytest_mh/_private/topology_controller.py +++ b/pytest_mh/_private/topology_controller.py @@ -282,7 +282,7 @@ def hosts(self) -> list[MultihostHost]: return self.__hosts - def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) -> set[str]: + def get_artifacts_list(self, host: MultihostHost, artifacts_type: MultihostArtifactsType) -> set[str]: """ Return the list of artifacts to collect. @@ -293,12 +293,12 @@ def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) :param host: Host where the artifacts are being collected. :type host: MultihostHost - :param type: Type of artifacts that are being collected. - :type type: MultihostArtifactsType + :param artifacts_type: Type of artifacts that are being collected. + :type artifacts_type: MultihostArtifactsType :return: List of artifacts to collect. :rtype: set[str] """ - return self.artifacts.get(host, type) + return self.artifacts.get(host, artifacts_type) def set_artifacts(self, *args, **kwargs) -> None: """ diff --git a/pytest_mh/utils/coredumpd.py b/pytest_mh/utils/coredumpd.py index 03b6da8..32cb7d2 100644 --- a/pytest_mh/utils/coredumpd.py +++ b/pytest_mh/utils/coredumpd.py @@ -125,14 +125,14 @@ def parse_core_file_name(self, name: str) -> tuple[str, str]: return (pid, timestamp) - def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) -> set[str]: + def get_artifacts_list(self, host: MultihostHost, artifacts_type: MultihostArtifactsType) -> set[str]: """ Dump backtrace and other information from generated core files for easy access. :param host: Host where the artifacts are being collected. :type host: MultihostHost - :param type: Type of artifacts that are being collected. - :type type: MultihostArtifactsType + :param artifacts_type: Type of artifacts that are being collected. + :type artifacts_type: MultihostArtifactsType :return: List of artifacts to collect. :rtype: set[str] """ diff --git a/pytest_mh/utils/journald.py b/pytest_mh/utils/journald.py index c529381..95b1ae4 100644 --- a/pytest_mh/utils/journald.py +++ b/pytest_mh/utils/journald.py @@ -39,14 +39,14 @@ def setup(self) -> None: """ self._test_start = self.now - def get_artifacts_list(self, host: MultihostHost, type: MultihostArtifactsType) -> set[str]: + def get_artifacts_list(self, host: MultihostHost, artifacts_type: MultihostArtifactsType) -> set[str]: """ Dump journald into file that can be collected. :param host: Host where the artifacts are being collected. :type host: MultihostHost - :param type: Type of artifacts that are being collected. - :type type: MultihostArtifactsType + :param artifacts_type: Type of artifacts that are being collected. + :type artifacts_type: MultihostArtifactsType :return: List of artifacts to collect. :rtype: set[str] """