1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

uthelper: make str and repr generic in base class (#10985)

* uthelper: make str and repr generic in base class

* Update tests/unit/plugins/modules/uthelper.py
This commit is contained in:
Alexei Znamensky 2025-10-26 21:40:47 +13:00 committed by GitHub
parent cf663c6e95
commit 32dd5f04c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -203,6 +203,12 @@ class TestCaseMock:
def build_mock(cls, mock_specs):
return cls(mock_specs)
def __str__(self):
return f"<{self.__class__.__name__} specs={self.mock_specs}>"
def __repr__(self):
return f"{self.__class__.__name__}({self.mock_specs})"
def __init__(self, mock_specs):
self.mock_specs = mock_specs
@ -219,12 +225,6 @@ class TestCaseMock:
class RunCommandMock(TestCaseMock):
name = "run_command"
def __str__(self):
return "<RunCommandMock specs={specs}>".format(specs=self.mock_specs)
def __repr__(self):
return "RunCommandMock({specs})".format(specs=self.mock_specs)
def fixtures(self):
@pytest.fixture
def patch_bin(mocker):