diff --git a/testgres/api.py b/testgres/api.py index e4b1cdd5..6a96ee84 100644 --- a/testgres/api.py +++ b/testgres/api.py @@ -47,8 +47,6 @@ def get_remote_node(name=None, conn_params=None): Simply a wrapper around :class:`.PostgresNode` constructor for remote node. See :meth:`.PostgresNode.__init__` for details. For remote connection you can add the next parameter: - conn_params = ConnectionParams(host='127.0.0.1', - ssh_key=None, - username=default_username()) + conn_params = ConnectionParams(host='127.0.0.1', ssh_key=None, username=default_username()) """ return get_new_node(name=name, conn_params=conn_params) diff --git a/testgres/node.py b/testgres/node.py index b85a62f2..8a712753 100644 --- a/testgres/node.py +++ b/testgres/node.py @@ -1939,6 +1939,7 @@ def make_simple( return node + @staticmethod def _gettempdir_for_socket(): platform_system_name = platform.system().lower() @@ -1966,6 +1967,7 @@ def _gettempdir_for_socket(): return "/tmp" + @staticmethod def _gettempdir(): v = tempfile.gettempdir() @@ -1984,6 +1986,7 @@ def _gettempdir(): # OK return v + @staticmethod def _raise_bugcheck(msg): assert type(msg) == str # noqa: E721 assert msg != "" diff --git a/testgres/operations/helpers.py b/testgres/operations/helpers.py index b50f0baa..03e97edc 100644 --- a/testgres/operations/helpers.py +++ b/testgres/operations/helpers.py @@ -2,6 +2,7 @@ class Helpers: + @staticmethod def _make_get_default_encoding_func(): # locale.getencoding is added in Python 3.11 if hasattr(locale, 'getencoding'): @@ -13,6 +14,7 @@ def _make_get_default_encoding_func(): # Prepared pointer on function to get a name of system codepage _get_default_encoding_func = _make_get_default_encoding_func() + @staticmethod def GetDefaultEncoding(): # # Original idea/source was: @@ -36,6 +38,7 @@ def GetDefaultEncoding(): # Is it an unexpected situation? return 'UTF-8' + @staticmethod def PrepareProcessInput(input, encoding): if not input: return None diff --git a/testgres/operations/local_ops.py b/testgres/operations/local_ops.py index 5c79bb7e..91070fe7 100644 --- a/testgres/operations/local_ops.py +++ b/testgres/operations/local_ops.py @@ -265,6 +265,7 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal data2 = __class__._prepare_data_to_write(data, binary) file.write(data2) + @staticmethod def _prepare_line_to_write(data, binary): data = __class__._prepare_data_to_write(data, binary) @@ -275,6 +276,7 @@ def _prepare_line_to_write(data, binary): assert type(data) == str # noqa: E721 return data.rstrip('\n') + '\n' + @staticmethod def _prepare_data_to_write(data, binary): if isinstance(data, bytes): return data if binary else data.decode() diff --git a/testgres/operations/raise_error.py b/testgres/operations/raise_error.py index 0e760e74..6031b238 100644 --- a/testgres/operations/raise_error.py +++ b/testgres/operations/raise_error.py @@ -3,6 +3,7 @@ class RaiseError: + @staticmethod def UtilityExitedWithNonZeroCode(cmd, exit_code, msg_arg, error, out): assert type(exit_code) == int # noqa: E721 @@ -20,12 +21,14 @@ def UtilityExitedWithNonZeroCode(cmd, exit_code, msg_arg, error, out): out=out, error=error) + @staticmethod def _TranslateDataIntoString(data): if type(data) == bytes: # noqa: E721 return __class__._TranslateDataIntoString__FromBinary(data) return str(data) + @staticmethod def _TranslateDataIntoString__FromBinary(data): assert type(data) == bytes # noqa: E721 @@ -36,6 +39,7 @@ def _TranslateDataIntoString__FromBinary(data): return "#cannot_decode_text" + @staticmethod def _BinaryIsASCII(data): assert type(data) == bytes # noqa: E721 diff --git a/testgres/operations/remote_ops.py b/testgres/operations/remote_ops.py index af4c59f9..51f5b2e8 100644 --- a/testgres/operations/remote_ops.py +++ b/testgres/operations/remote_ops.py @@ -313,6 +313,7 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal os.remove(tmp_file.name) + @staticmethod def _prepare_line_to_write(data, binary, encoding): data = __class__._prepare_data_to_write(data, binary, encoding) @@ -323,6 +324,7 @@ def _prepare_line_to_write(data, binary, encoding): assert type(data) == str # noqa: E721 return data.rstrip('\n') + '\n' + @staticmethod def _prepare_data_to_write(data, binary, encoding): if isinstance(data, bytes): return data if binary else data.decode(encoding) diff --git a/tests/test_simple.py b/tests/test_simple.py index 4e6fb573..a751f0a3 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -1125,6 +1125,7 @@ def __exit__(self, type, value, traceback): __class__.sm_prev_testgres_reserve_port = None __class__.sm_prev_testgres_release_port = None + @staticmethod def _proxy__reserve_port(): assert type(__class__.sm_DummyPortMaxUsage) == int # noqa: E721 assert type(__class__.sm_DummyPortTotalUsage) == int # noqa: E721 @@ -1144,6 +1145,7 @@ def _proxy__reserve_port(): __class__.sm_DummyPortCurrentUsage += 1 return __class__.sm_DummyPortNumber + @staticmethod def _proxy__release_port(dummyPortNumber): assert type(dummyPortNumber) == int # noqa: E721