Skip to content

Commit

Permalink
artifacts: rename type to artifacts_type in get_artifacts_list
Browse files Browse the repository at this point in the history
...to avoid shadowing global `type()`.
  • Loading branch information
pbrezina committed Sep 10, 2024
1 parent bfe4879 commit 5a81eab
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
14 changes: 7 additions & 7 deletions pytest_mh/_private/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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]
"""
Expand Down Expand Up @@ -212,7 +212,7 @@ def should_collect(self, outcome: MultihostOutcome) -> bool:

def collect(
self,
type: MultihostArtifactsType,
artifacts_type: MultihostArtifactsType,
*,
path: str,
outcome: MultihostOutcome,
Expand All @@ -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.
Expand All @@ -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)

Expand Down
20 changes: 10 additions & 10 deletions pytest_mh/_private/multihost.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
"""
Expand Down Expand Up @@ -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.
Expand All @@ -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]
"""
Expand Down Expand Up @@ -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.
Expand All @@ -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]
"""
Expand Down
8 changes: 4 additions & 4 deletions pytest_mh/_private/topology_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
"""
Expand Down
6 changes: 3 additions & 3 deletions pytest_mh/utils/coredumpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
"""
Expand Down
6 changes: 3 additions & 3 deletions pytest_mh/utils/journald.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
"""
Expand Down

0 comments on commit 5a81eab

Please sign in to comment.