testgres 1.13.0__tar.gz → 1.13.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {testgres-1.13.0/testgres.egg-info → testgres-1.13.2}/PKG-INFO +3 -3
  2. {testgres-1.13.0 → testgres-1.13.2}/README.md +1 -1
  3. {testgres-1.13.0 → testgres-1.13.2}/pyproject.toml +2 -2
  4. {testgres-1.13.0 → testgres-1.13.2}/src/node.py +47 -11
  5. {testgres-1.13.0 → testgres-1.13.2/testgres.egg-info}/PKG-INFO +3 -3
  6. {testgres-1.13.0 → testgres-1.13.2}/testgres.egg-info/requires.txt +1 -1
  7. {testgres-1.13.0 → testgres-1.13.2}/tests/test_os_ops_common.py +48 -2
  8. {testgres-1.13.0 → testgres-1.13.2}/LICENSE +0 -0
  9. {testgres-1.13.0 → testgres-1.13.2}/setup.cfg +0 -0
  10. {testgres-1.13.0 → testgres-1.13.2}/src/__init__.py +0 -0
  11. {testgres-1.13.0 → testgres-1.13.2}/src/api.py +0 -0
  12. {testgres-1.13.0 → testgres-1.13.2}/src/backup.py +0 -0
  13. {testgres-1.13.0 → testgres-1.13.2}/src/cache.py +0 -0
  14. {testgres-1.13.0 → testgres-1.13.2}/src/config.py +0 -0
  15. {testgres-1.13.0 → testgres-1.13.2}/src/connection.py +0 -0
  16. {testgres-1.13.0 → testgres-1.13.2}/src/consts.py +0 -0
  17. {testgres-1.13.0 → testgres-1.13.2}/src/decorators.py +0 -0
  18. {testgres-1.13.0 → testgres-1.13.2}/src/defaults.py +0 -0
  19. {testgres-1.13.0 → testgres-1.13.2}/src/enums.py +0 -0
  20. {testgres-1.13.0 → testgres-1.13.2}/src/exceptions.py +0 -0
  21. {testgres-1.13.0 → testgres-1.13.2}/src/impl/port_manager__generic.py +0 -0
  22. {testgres-1.13.0 → testgres-1.13.2}/src/impl/port_manager__this_host.py +0 -0
  23. {testgres-1.13.0 → testgres-1.13.2}/src/logger.py +0 -0
  24. {testgres-1.13.0 → testgres-1.13.2}/src/node_app.py +0 -0
  25. {testgres-1.13.0 → testgres-1.13.2}/src/port_manager.py +0 -0
  26. {testgres-1.13.0 → testgres-1.13.2}/src/pubsub.py +0 -0
  27. {testgres-1.13.0 → testgres-1.13.2}/src/raise_error.py +0 -0
  28. {testgres-1.13.0 → testgres-1.13.2}/src/standby.py +0 -0
  29. {testgres-1.13.0 → testgres-1.13.2}/src/utils.py +0 -0
  30. {testgres-1.13.0 → testgres-1.13.2}/testgres.egg-info/SOURCES.txt +0 -0
  31. {testgres-1.13.0 → testgres-1.13.2}/testgres.egg-info/dependency_links.txt +0 -0
  32. {testgres-1.13.0 → testgres-1.13.2}/testgres.egg-info/top_level.txt +0 -0
  33. {testgres-1.13.0 → testgres-1.13.2}/tests/test_config.py +0 -0
  34. {testgres-1.13.0 → testgres-1.13.2}/tests/test_os_ops_local.py +0 -0
  35. {testgres-1.13.0 → testgres-1.13.2}/tests/test_os_ops_remote.py +0 -0
  36. {testgres-1.13.0 → testgres-1.13.2}/tests/test_raise_error.py +0 -0
  37. {testgres-1.13.0 → testgres-1.13.2}/tests/test_testgres_common.py +0 -0
  38. {testgres-1.13.0 → testgres-1.13.2}/tests/test_testgres_local.py +0 -0
  39. {testgres-1.13.0 → testgres-1.13.2}/tests/test_testgres_remote.py +0 -0
  40. {testgres-1.13.0 → testgres-1.13.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres
3
- Version: 1.13.0
3
+ Version: 1.13.2
4
4
  Summary: Testing utility for PostgreSQL and its extensions
5
5
  Author-email: Postgres Professional <testgres@postgrespro.ru>
6
6
  License: PostgreSQL
@@ -27,10 +27,10 @@ Requires-Dist: port-for>=0.4
27
27
  Requires-Dist: six>=1.9.0
28
28
  Requires-Dist: psutil
29
29
  Requires-Dist: packaging
30
- Requires-Dist: testgres.os_ops<3.0.0,>=2.0.0
30
+ Requires-Dist: testgres.os_ops<3.0.0,>=2.0.1
31
31
  Dynamic: license-file
32
32
 
33
- [![Build Status](https://api.travis-ci.com/postgrespro/testgres.svg?branch=master)](https://travis-ci.com/github/postgrespro/testgres)
33
+ [![CI Status](https://img.shields.io/github/actions/workflow/status/postgrespro/testgres/.github/workflows/package-verification.yml?label=CI)](https://github.com/postgrespro/testgres/actions/workflows/package-verification.yml)
34
34
  [![codecov](https://codecov.io/gh/postgrespro/testgres/branch/master/graph/badge.svg)](https://codecov.io/gh/postgrespro/testgres)
35
35
  [![PyPI package version](https://badge.fury.io/py/testgres.svg)](https://badge.fury.io/py/testgres)
36
36
  [![PyPI python versions](https://img.shields.io/pypi/pyversions/testgres)](https://pypi.org/project/testgres)
@@ -1,4 +1,4 @@
1
- [![Build Status](https://api.travis-ci.com/postgrespro/testgres.svg?branch=master)](https://travis-ci.com/github/postgrespro/testgres)
1
+ [![CI Status](https://img.shields.io/github/actions/workflow/status/postgrespro/testgres/.github/workflows/package-verification.yml?label=CI)](https://github.com/postgrespro/testgres/actions/workflows/package-verification.yml)
2
2
  [![codecov](https://codecov.io/gh/postgrespro/testgres/branch/master/graph/badge.svg)](https://codecov.io/gh/postgrespro/testgres)
3
3
  [![PyPI package version](https://badge.fury.io/py/testgres.svg)](https://badge.fury.io/py/testgres)
4
4
  [![PyPI python versions](https://img.shields.io/pypi/pyversions/testgres)](https://pypi.org/project/testgres)
@@ -11,7 +11,7 @@ exclude = [".git", "__pycache__", "env", "venv"]
11
11
 
12
12
  [project]
13
13
  name = "testgres"
14
- version = "1.13.0"
14
+ version = "1.13.2"
15
15
 
16
16
  description = "Testing utility for PostgreSQL and its extensions"
17
17
  readme = "README.md"
@@ -54,7 +54,7 @@ dependencies = [
54
54
  "six>=1.9.0",
55
55
  "psutil",
56
56
  "packaging",
57
- "testgres.os_ops>=2.0.0,<3.0.0",
57
+ "testgres.os_ops>=2.0.1,<3.0.0",
58
58
  ]
59
59
 
60
60
  [project.urls]
@@ -1002,7 +1002,12 @@ class PostgresNode(object):
1002
1002
  raise
1003
1003
  return
1004
1004
 
1005
- def start(self, params=[], wait=True, exec_env=None) -> PostgresNode:
1005
+ def start(
1006
+ self,
1007
+ params: typing.Optional[typing.List[str]] = None,
1008
+ wait: bool = True,
1009
+ exec_env: typing.Optional[typing.Dict] = None,
1010
+ ) -> PostgresNode:
1006
1011
  """
1007
1012
  Starts the PostgreSQL node using pg_ctl and set flag 'is_started'.
1008
1013
  By default, it waits for the operation to complete before returning.
@@ -1016,7 +1021,11 @@ class PostgresNode(object):
1016
1021
  Returns:
1017
1022
  This instance of :class:`.PostgresNode`.
1018
1023
  """
1019
- self.start2()
1024
+ assert params is None or type(params) == list # noqa: E721
1025
+ assert type(wait) == bool # noqa: E721
1026
+ assert exec_env is None or type(exec_env) == dict # noqa: E721
1027
+
1028
+ self._start(params, wait, exec_env)
1020
1029
 
1021
1030
  if not wait:
1022
1031
  # Postmaster process is starting in background
@@ -1029,7 +1038,12 @@ class PostgresNode(object):
1029
1038
  assert type(self._manually_started_pm_pid) == int # noqa: E721
1030
1039
  return self
1031
1040
 
1032
- def start2(self, params=[], wait=True, exec_env=None) -> None:
1041
+ def start2(
1042
+ self,
1043
+ params: typing.Optional[typing.List[str]] = None,
1044
+ wait: bool = True,
1045
+ exec_env: typing.Optional[typing.Dict] = None,
1046
+ ) -> None:
1033
1047
  """
1034
1048
  Starts the PostgreSQL node using pg_ctl.
1035
1049
  By default, it waits for the operation to complete before returning.
@@ -1041,9 +1055,25 @@ class PostgresNode(object):
1041
1055
  wait: wait until operation completes.
1042
1056
 
1043
1057
  Returns:
1044
- This instance of :class:`.PostgresNode`.
1058
+ None.
1045
1059
  """
1060
+ assert params is None or type(params) == list # noqa: E721
1061
+ assert type(wait) == bool # noqa: E721
1062
+ assert exec_env is None or type(exec_env) == dict # noqa: E721
1063
+
1064
+ self._start(params, wait, exec_env)
1065
+ return
1066
+
1067
+ def _start(
1068
+ self,
1069
+ params: typing.Optional[typing.List[str]] = None,
1070
+ wait: bool = True,
1071
+ exec_env: typing.Optional[typing.Dict] = None,
1072
+ ) -> None:
1073
+ assert params is None or type(params) == list # noqa: E721
1074
+ assert type(wait) == bool # noqa: E721
1046
1075
  assert exec_env is None or type(exec_env) == dict # noqa: E721
1076
+
1047
1077
  assert __class__._C_MAX_START_ATEMPTS > 1
1048
1078
 
1049
1079
  if self._port is None:
@@ -1051,11 +1081,17 @@ class PostgresNode(object):
1051
1081
 
1052
1082
  assert type(self._port) == int # noqa: E721
1053
1083
 
1054
- _params = [self._get_bin_path("pg_ctl"),
1055
- "-D", self.data_dir,
1056
- "-l", self.pg_log_file,
1057
- "-w" if wait else '-W', # --wait or --no-wait
1058
- "start"] + params # yapf: disable
1084
+ _params = [
1085
+ self._get_bin_path("pg_ctl"),
1086
+ "start",
1087
+ "-D", self.data_dir,
1088
+ "-l", self.pg_log_file,
1089
+ "-w" if wait else '-W', # --wait or --no-wait
1090
+ ]
1091
+
1092
+ if params is not None:
1093
+ assert type(params) == list # noqa: E721
1094
+ _params += params
1059
1095
 
1060
1096
  def LOCAL__start_node():
1061
1097
  # 'error' will be None on Windows
@@ -2304,7 +2340,7 @@ class PostgresNodeLogReader:
2304
2340
  assert self._node is not None
2305
2341
  assert isinstance(self._node, PostgresNode)
2306
2342
 
2307
- cur_logs: typing.Dict[__class__.LogInfo] = self._collect_logs()
2343
+ cur_logs: typing.Dict[str, __class__.LogInfo] = self._collect_logs()
2308
2344
  assert cur_logs is not None
2309
2345
  assert type(cur_logs) == dict # noqa: E721
2310
2346
 
@@ -2353,7 +2389,7 @@ class PostgresNodeLogReader:
2353
2389
 
2354
2390
  return result
2355
2391
 
2356
- def _collect_logs(self) -> typing.Dict[LogInfo]:
2392
+ def _collect_logs(self) -> typing.Dict[str, LogInfo]:
2357
2393
  assert self._node is not None
2358
2394
  assert isinstance(self._node, PostgresNode)
2359
2395
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres
3
- Version: 1.13.0
3
+ Version: 1.13.2
4
4
  Summary: Testing utility for PostgreSQL and its extensions
5
5
  Author-email: Postgres Professional <testgres@postgrespro.ru>
6
6
  License: PostgreSQL
@@ -27,10 +27,10 @@ Requires-Dist: port-for>=0.4
27
27
  Requires-Dist: six>=1.9.0
28
28
  Requires-Dist: psutil
29
29
  Requires-Dist: packaging
30
- Requires-Dist: testgres.os_ops<3.0.0,>=2.0.0
30
+ Requires-Dist: testgres.os_ops<3.0.0,>=2.0.1
31
31
  Dynamic: license-file
32
32
 
33
- [![Build Status](https://api.travis-ci.com/postgrespro/testgres.svg?branch=master)](https://travis-ci.com/github/postgrespro/testgres)
33
+ [![CI Status](https://img.shields.io/github/actions/workflow/status/postgrespro/testgres/.github/workflows/package-verification.yml?label=CI)](https://github.com/postgrespro/testgres/actions/workflows/package-verification.yml)
34
34
  [![codecov](https://codecov.io/gh/postgrespro/testgres/branch/master/graph/badge.svg)](https://codecov.io/gh/postgrespro/testgres)
35
35
  [![PyPI package version](https://badge.fury.io/py/testgres.svg)](https://badge.fury.io/py/testgres)
36
36
  [![PyPI python versions](https://img.shields.io/pypi/pyversions/testgres)](https://pypi.org/project/testgres)
@@ -3,4 +3,4 @@ port-for>=0.4
3
3
  six>=1.9.0
4
4
  psutil
5
5
  packaging
6
- testgres.os_ops<3.0.0,>=2.0.0
6
+ testgres.os_ops<3.0.0,>=2.0.1
@@ -130,6 +130,44 @@ class TestOsOpsCommon:
130
130
  assert type(response) == bytes # noqa: E721
131
131
  assert response == b'\n'
132
132
 
133
+ def test_exec_command_with_exec_env__2(self, os_ops: OsOperations):
134
+ assert isinstance(os_ops, OsOperations)
135
+
136
+ RunConditions.skip_if_windows()
137
+
138
+ C_ENV_NAME = "TESTGRES_TEST__EXEC_ENV_20250414"
139
+
140
+ tmp_file_content = "echo ${{{}}}".format(C_ENV_NAME)
141
+
142
+ logging.info("content is [{}]".format(tmp_file_content))
143
+
144
+ tmp_file = os_ops.mkstemp()
145
+ assert type(tmp_file) == str # noqa: E721
146
+ assert tmp_file != ""
147
+
148
+ logging.info("file is [{}]".format(tmp_file))
149
+ assert os_ops.path_exists(tmp_file)
150
+
151
+ os_ops.write(tmp_file, tmp_file_content)
152
+
153
+ cmd = ["sh", tmp_file]
154
+
155
+ exec_env = {C_ENV_NAME: "Hello!"}
156
+
157
+ response = os_ops.exec_command(cmd, exec_env=exec_env)
158
+ assert response is not None
159
+ assert type(response) == bytes # noqa: E721
160
+ assert response == b'Hello!\n'
161
+
162
+ response = os_ops.exec_command(cmd)
163
+ assert response is not None
164
+ assert type(response) == bytes # noqa: E721
165
+ assert response == b'\n'
166
+
167
+ os_ops.remove_file(tmp_file)
168
+ assert not os_ops.path_exists(tmp_file)
169
+ return
170
+
133
171
  def test_exec_command_with_cwd(self, os_ops: OsOperations):
134
172
  assert isinstance(os_ops, OsOperations)
135
173
 
@@ -876,8 +914,16 @@ class TestOsOpsCommon:
876
914
  actual_dir = os_ops.get_tempdir()
877
915
  assert actual_dir is not None
878
916
  assert type(actual_dir) == str # noqa: E721
879
- expected_dir = str(tempfile.tempdir)
880
- assert actual_dir == expected_dir
917
+
918
+ # --------
919
+ cmd = [sys.executable, "-c", "import tempfile;print(tempfile.gettempdir());"]
920
+
921
+ expected_dir_b = os_ops.exec_command(cmd)
922
+ assert type(expected_dir_b) == bytes # noqa: E721
923
+ expected_dir = expected_dir_b.decode()
924
+ assert type(expected_dir) == str # noqa: E721
925
+ assert actual_dir + "\n" == expected_dir
926
+ return
881
927
 
882
928
  class tagData_OS_OPS__NUMS:
883
929
  os_ops_descr: OsOpsDescr
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes