testgres 1.13.5__tar.gz → 1.13.7__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 (45) hide show
  1. {testgres-1.13.5/testgres.egg-info → testgres-1.13.7}/PKG-INFO +1 -1
  2. {testgres-1.13.5 → testgres-1.13.7}/pyproject.toml +4 -1
  3. {testgres-1.13.5 → testgres-1.13.7}/src/__init__.py +2 -0
  4. {testgres-1.13.5 → testgres-1.13.7}/src/backup.py +1 -1
  5. {testgres-1.13.5 → testgres-1.13.7}/src/cache.py +1 -1
  6. {testgres-1.13.5 → testgres-1.13.7}/src/exceptions.py +22 -22
  7. {testgres-1.13.5 → testgres-1.13.7}/src/impl/internal_utils.py +4 -4
  8. {testgres-1.13.5 → testgres-1.13.7}/src/impl/platforms/internal_platform_utils.py +5 -5
  9. {testgres-1.13.5 → testgres-1.13.7}/src/impl/platforms/internal_platform_utils_factory.py +1 -1
  10. {testgres-1.13.5 → testgres-1.13.7}/src/impl/platforms/linux/internal_platform_utils.py +14 -14
  11. {testgres-1.13.5 → testgres-1.13.7}/src/impl/platforms/win32/internal_platform_utils.py +2 -2
  12. {testgres-1.13.5 → testgres-1.13.7}/src/impl/port_manager__generic.py +11 -11
  13. {testgres-1.13.5 → testgres-1.13.7}/src/impl/port_manager__this_host.py +3 -3
  14. {testgres-1.13.5 → testgres-1.13.7}/src/node.py +116 -115
  15. {testgres-1.13.5 → testgres-1.13.7}/src/node_app.py +26 -29
  16. {testgres-1.13.5 → testgres-1.13.7}/src/port_manager.py +1 -1
  17. {testgres-1.13.5 → testgres-1.13.7}/src/raise_error.py +4 -4
  18. {testgres-1.13.5 → testgres-1.13.7}/src/utils.py +15 -15
  19. {testgres-1.13.5 → testgres-1.13.7/testgres.egg-info}/PKG-INFO +1 -1
  20. {testgres-1.13.5 → testgres-1.13.7}/tests/test_os_ops_common.py +75 -75
  21. {testgres-1.13.5 → testgres-1.13.7}/tests/test_os_ops_local.py +2 -2
  22. {testgres-1.13.5 → testgres-1.13.7}/tests/test_os_ops_remote.py +5 -4
  23. {testgres-1.13.5 → testgres-1.13.7}/tests/test_raise_error.py +5 -5
  24. {testgres-1.13.5 → testgres-1.13.7}/tests/test_testgres_common.py +179 -147
  25. {testgres-1.13.5 → testgres-1.13.7}/tests/test_testgres_local.py +16 -16
  26. {testgres-1.13.5 → testgres-1.13.7}/tests/test_testgres_remote.py +5 -4
  27. {testgres-1.13.5 → testgres-1.13.7}/LICENSE +0 -0
  28. {testgres-1.13.5 → testgres-1.13.7}/README.md +0 -0
  29. {testgres-1.13.5 → testgres-1.13.7}/setup.cfg +0 -0
  30. {testgres-1.13.5 → testgres-1.13.7}/src/api.py +0 -0
  31. {testgres-1.13.5 → testgres-1.13.7}/src/config.py +0 -0
  32. {testgres-1.13.5 → testgres-1.13.7}/src/connection.py +0 -0
  33. {testgres-1.13.5 → testgres-1.13.7}/src/consts.py +0 -0
  34. {testgres-1.13.5 → testgres-1.13.7}/src/decorators.py +0 -0
  35. {testgres-1.13.5 → testgres-1.13.7}/src/defaults.py +0 -0
  36. {testgres-1.13.5 → testgres-1.13.7}/src/enums.py +0 -0
  37. {testgres-1.13.5 → testgres-1.13.7}/src/logger.py +0 -0
  38. {testgres-1.13.5 → testgres-1.13.7}/src/pubsub.py +0 -0
  39. {testgres-1.13.5 → testgres-1.13.7}/src/standby.py +0 -0
  40. {testgres-1.13.5 → testgres-1.13.7}/testgres.egg-info/SOURCES.txt +0 -0
  41. {testgres-1.13.5 → testgres-1.13.7}/testgres.egg-info/dependency_links.txt +0 -0
  42. {testgres-1.13.5 → testgres-1.13.7}/testgres.egg-info/requires.txt +0 -0
  43. {testgres-1.13.5 → testgres-1.13.7}/testgres.egg-info/top_level.txt +0 -0
  44. {testgres-1.13.5 → testgres-1.13.7}/tests/test_config.py +0 -0
  45. {testgres-1.13.5 → testgres-1.13.7}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres
3
- Version: 1.13.5
3
+ Version: 1.13.7
4
4
  Summary: Testing utility for PostgreSQL and its extensions
5
5
  Author-email: Postgres Professional <testgres@postgrespro.ru>
6
6
  License: PostgreSQL
@@ -5,6 +5,9 @@ build-backend = "setuptools.build_meta"
5
5
  [tool.setuptools.package-dir]
6
6
  "testgres" = "src"
7
7
 
8
+ [tool.setuptools.dynamic]
9
+ version = {attr = "testgres.__version__"}
10
+
8
11
  [tool.flake8]
9
12
  extend-ignore = ["E501"]
10
13
  exclude = [".git", "__pycache__", "env", "venv"]
@@ -19,7 +22,7 @@ log_file_date_format = "%Y-%m-%d %H:%M:%S"
19
22
 
20
23
  [project]
21
24
  name = "testgres"
22
- version = "1.13.5"
25
+ dynamic = ["version"]
23
26
 
24
27
  description = "Testing utility for PostgreSQL and its extensions"
25
28
  readme = "README.md"
@@ -56,6 +56,8 @@ from testgres.operations.os_ops import OsOperations, ConnectionParams
56
56
  from testgres.operations.local_ops import LocalOperations
57
57
  from testgres.operations.remote_ops import RemoteOperations
58
58
 
59
+ __version__ = "1.13.7"
60
+
59
61
  __all__ = [
60
62
  "get_new_node",
61
63
  "get_remote_node",
@@ -160,7 +160,7 @@ class NodeBackup(object):
160
160
  node = NodeClass(name=name, base_dir=base_dir, conn_params=self.original_node.os_ops.conn_params)
161
161
 
162
162
  assert node is not None
163
- assert type(node) == self.original_node.__class__ # noqa: E721
163
+ assert type(node) is self.original_node.__class__
164
164
 
165
165
  with clean_on_error(node) as node:
166
166
  # Set a new port
@@ -34,7 +34,7 @@ def cached_initdb(data_dir, logfile=None, params=None, os_ops: OsOperations = No
34
34
 
35
35
  def make_utility_path(name):
36
36
  assert name is not None
37
- assert type(name) == str # noqa: E721
37
+ assert type(name) is str
38
38
 
39
39
  if bin_path:
40
40
  return os_ops.build_path(bin_path, name)
@@ -15,14 +15,14 @@ class PortForException(TestgresException):
15
15
  self,
16
16
  message: typing.Optional[str] = None,
17
17
  ):
18
- assert message is None or type(message) == str # noqa: E721
18
+ assert message is None or type(message) is str
19
19
  super().__init__(message)
20
20
  self._message = message
21
21
  return
22
22
 
23
23
  @property
24
24
  def message(self) -> str:
25
- assert self._message is None or type(self._message) == str # noqa: E721
25
+ assert self._message is None or type(self._message) is str
26
26
  if self._message is None:
27
27
  return ""
28
28
  return self._message
@@ -53,8 +53,8 @@ class QueryException(TestgresException):
53
53
  message: typing.Optional[str] = None,
54
54
  query: typing.Optional[str] = None
55
55
  ):
56
- assert message is None or type(message) == str # noqa: E721
57
- assert query is None or type(query) == str # noqa: E721
56
+ assert message is None or type(message) is str
57
+ assert query is None or type(query) is str
58
58
 
59
59
  super().__init__(message)
60
60
 
@@ -64,8 +64,8 @@ class QueryException(TestgresException):
64
64
 
65
65
  @property
66
66
  def message(self) -> str:
67
- assert self._description is None or type(self._description) == str # noqa: E721
68
- assert self._query is None or type(self._query) == str # noqa: E721
67
+ assert self._description is None or type(self._description) is str
68
+ assert self._query is None or type(self._query) is str
69
69
 
70
70
  msg = []
71
71
 
@@ -76,17 +76,17 @@ class QueryException(TestgresException):
76
76
  msg.append(u'Query: {}'.format(self._query))
77
77
 
78
78
  r = six.text_type('\n').join(msg)
79
- assert type(r) == str # noqa: E721
79
+ assert type(r) is str
80
80
  return r
81
81
 
82
82
  @property
83
83
  def description(self) -> typing.Optional[str]:
84
- assert self._description is None or type(self._description) == str # noqa: E721
84
+ assert self._description is None or type(self._description) is str
85
85
  return self._description
86
86
 
87
87
  @property
88
88
  def query(self) -> typing.Optional[str]:
89
- assert self._query is None or type(self._query) == str # noqa: E721
89
+ assert self._query is None or type(self._query) is str
90
90
  return self._query
91
91
 
92
92
  def __repr__(self) -> str:
@@ -114,8 +114,8 @@ class QueryTimeoutException(QueryException):
114
114
  message: typing.Optional[str] = None,
115
115
  query: typing.Optional[str] = None
116
116
  ):
117
- assert message is None or type(message) == str # noqa: E721
118
- assert query is None or type(query) == str # noqa: E721
117
+ assert message is None or type(message) is str
118
+ assert query is None or type(query) is str
119
119
 
120
120
  super().__init__(message, query)
121
121
  return
@@ -133,14 +133,14 @@ class CatchUpException(TestgresException):
133
133
  self,
134
134
  message: typing.Optional[str] = None,
135
135
  ):
136
- assert message is None or type(message) == str # noqa: E721
136
+ assert message is None or type(message) is str
137
137
  super().__init__(message)
138
138
  self._message = message
139
139
  return
140
140
 
141
141
  @property
142
142
  def message(self) -> str:
143
- assert self._message is None or type(self._message) == str # noqa: E721
143
+ assert self._message is None or type(self._message) is str
144
144
  if self._message is None:
145
145
  return ""
146
146
  return self._message
@@ -171,7 +171,7 @@ class StartNodeException(TestgresException):
171
171
  message: typing.Optional[str] = None,
172
172
  files: typing.Optional[typing.Iterable] = None
173
173
  ):
174
- assert message is None or type(message) == str # noqa: E721
174
+ assert message is None or type(message) is str
175
175
  assert files is None or isinstance(files, typing.Iterable)
176
176
 
177
177
  super().__init__(message)
@@ -182,7 +182,7 @@ class StartNodeException(TestgresException):
182
182
 
183
183
  @property
184
184
  def message(self) -> str:
185
- assert self._description is None or type(self._description) == str # noqa: E721
185
+ assert self._description is None or type(self._description) is str
186
186
  assert self._files is None or isinstance(self._files, typing.Iterable)
187
187
 
188
188
  msg = []
@@ -191,15 +191,15 @@ class StartNodeException(TestgresException):
191
191
  msg.append(self._description)
192
192
 
193
193
  for f, lines in self._files or []:
194
- assert type(f) == str # noqa: E721
195
- assert type(lines) in [str, bytes] # noqa: E721
194
+ assert type(f) is str
195
+ assert type(lines) in [str, bytes]
196
196
  msg.append(u'{}\n----\n{}\n'.format(f, lines))
197
197
 
198
198
  return six.text_type('\n').join(msg)
199
199
 
200
200
  @property
201
201
  def description(self) -> typing.Optional[str]:
202
- assert self._description is None or type(self._description) == str # noqa: E721
202
+ assert self._description is None or type(self._description) is str
203
203
  return self._description
204
204
 
205
205
  @property
@@ -233,14 +233,14 @@ class InitNodeException(TestgresException):
233
233
  self,
234
234
  message: typing.Optional[str] = None,
235
235
  ):
236
- assert message is None or type(message) == str # noqa: E721
236
+ assert message is None or type(message) is str
237
237
  super().__init__(message)
238
238
  self._message = message
239
239
  return
240
240
 
241
241
  @property
242
242
  def message(self) -> str:
243
- assert self._message is None or type(self._message) == str # noqa: E721
243
+ assert self._message is None or type(self._message) is str
244
244
  if self._message is None:
245
245
  return ""
246
246
  return self._message
@@ -268,14 +268,14 @@ class BackupException(TestgresException):
268
268
  self,
269
269
  message: typing.Optional[str] = None,
270
270
  ):
271
- assert message is None or type(message) == str # noqa: E721
271
+ assert message is None or type(message) is str
272
272
  super().__init__(message)
273
273
  self._message = message
274
274
  return
275
275
 
276
276
  @property
277
277
  def message(self) -> str:
278
- assert self._message is None or type(self._message) == str # noqa: E721
278
+ assert self._message is None or type(self._message) is str
279
279
  if self._message is None:
280
280
  return ""
281
281
  return self._message
@@ -2,19 +2,19 @@ import logging
2
2
 
3
3
 
4
4
  def send_log(level: int, msg: str) -> None:
5
- assert type(level) == int # noqa: E721
6
- assert type(msg) == str # noqa: E721
5
+ assert type(level) is int
6
+ assert type(msg) is str
7
7
 
8
8
  return logging.log(level, "[testgres] " + msg)
9
9
 
10
10
 
11
11
  def send_log_info(msg: str) -> None:
12
- assert type(msg) == str # noqa: E721
12
+ assert type(msg) is str
13
13
 
14
14
  return send_log(logging.INFO, msg)
15
15
 
16
16
 
17
17
  def send_log_debug(msg: str) -> None:
18
- assert type(msg) == str # noqa: E721
18
+ assert type(msg) is str
19
19
 
20
20
  return send_log(logging.DEBUG, msg)
@@ -23,15 +23,15 @@ class InternalPlatformUtils:
23
23
  code: InternalPlatformUtils.FindPostmasterResultCode,
24
24
  pid: typing.Optional[int]
25
25
  ):
26
- assert type(code) == InternalPlatformUtils.FindPostmasterResultCode # noqa: E721
27
- assert pid is None or type(pid) == int # noqa: E721
26
+ assert type(code) is InternalPlatformUtils.FindPostmasterResultCode
27
+ assert pid is None or type(pid) is int
28
28
  self.code = code
29
29
  self.pid = pid
30
30
  return
31
31
 
32
32
  @staticmethod
33
33
  def create_ok(pid: int) -> InternalPlatformUtils.FindPostmasterResult:
34
- assert type(pid) == int # noqa: E721
34
+ assert type(pid) is int
35
35
  return __class__(InternalPlatformUtils.FindPostmasterResultCode.ok, pid)
36
36
 
37
37
  @staticmethod
@@ -57,6 +57,6 @@ class InternalPlatformUtils:
57
57
  data_dir: str
58
58
  ) -> FindPostmasterResult:
59
59
  assert isinstance(os_ops, OsOperations)
60
- assert type(bin_dir) == str # noqa: E721
61
- assert type(data_dir) == str # noqa: E721
60
+ assert type(bin_dir) is str
61
+ assert type(data_dir) is str
62
62
  raise NotImplementedError("InternalPlatformUtils::FindPostmaster is not implemented.")
@@ -9,7 +9,7 @@ def create_internal_platform_utils(
9
9
  assert isinstance(os_ops, OsOperations)
10
10
 
11
11
  platform_name = os_ops.get_platform()
12
- assert type(platform_name) == str # noqa: E721
12
+ assert type(platform_name) is str
13
13
 
14
14
  if platform_name == "linux":
15
15
  from .linux import internal_platform_utils as x
@@ -26,10 +26,10 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
26
26
  data_dir: str
27
27
  ) -> InternalPlatformUtils.FindPostmasterResult:
28
28
  assert isinstance(os_ops, OsOperations)
29
- assert type(bin_dir) == str # noqa: E721
30
- assert type(data_dir) == str # noqa: E721
31
- assert type(__class__.C_BASH_EXE) == str # noqa: E721
32
- assert type(__class__.sm_exec_env) == dict # noqa: E721
29
+ assert type(bin_dir) is str
30
+ assert type(data_dir) is str
31
+ assert type(__class__.C_BASH_EXE) is str
32
+ assert type(__class__.sm_exec_env) is dict
33
33
  assert len(__class__.C_BASH_EXE) > 0
34
34
  assert len(bin_dir) > 0
35
35
  assert len(data_dir) > 0
@@ -37,8 +37,8 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
37
37
  pg_path_e = re.escape(os_ops.build_path(bin_dir, "postgres"))
38
38
  data_dir_e = re.escape(data_dir)
39
39
 
40
- assert type(pg_path_e) == str # noqa: E721
41
- assert type(data_dir_e) == str # noqa: E721
40
+ assert type(pg_path_e) is str
41
+ assert type(data_dir_e) is str
42
42
 
43
43
  regexp = r"^\s*[0-9]+\s+" + pg_path_e + r"(\s+.*)?\s+\-[D]\s+" + data_dir_e + r"(\s+.*)?"
44
44
 
@@ -55,14 +55,14 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
55
55
  exec_env=__class__.sm_exec_env,
56
56
  )
57
57
 
58
- assert type(output_b) == bytes # noqa: E721
59
- assert type(error_b) == bytes # noqa: E721
58
+ assert type(output_b) is bytes
59
+ assert type(error_b) is bytes
60
60
 
61
61
  output = output_b.decode("utf-8")
62
62
  error = error_b.decode("utf-8")
63
63
 
64
- assert type(output) == str # noqa: E721
65
- assert type(error) == str # noqa: E721
64
+ assert type(output) is str
65
+ assert type(error) is str
66
66
 
67
67
  if exit_status == 1:
68
68
  return __class__.FindPostmasterResult.create_not_found()
@@ -78,7 +78,7 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
78
78
  )
79
79
 
80
80
  lines = output.splitlines()
81
- assert type(lines) == list # noqa: E721
81
+ assert type(lines) is list
82
82
 
83
83
  if len(lines) == 0:
84
84
  return __class__.FindPostmasterResult.create_not_found()
@@ -88,7 +88,7 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
88
88
  msgs.append("Many processes like a postmaster are found: {}.".format(len(lines)))
89
89
 
90
90
  for i in range(len(lines)):
91
- assert type(lines[i]) == str # noqa: E721
91
+ assert type(lines[i]) is str
92
92
  lines.append("[{}] '{}'".format(i, lines[i]))
93
93
  continue
94
94
 
@@ -96,7 +96,7 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
96
96
  return __class__.FindPostmasterResult.create_many_processes()
97
97
 
98
98
  def is_space_or_tab(ch) -> bool:
99
- assert type(ch) == str # noqa: E721
99
+ assert type(ch) is str
100
100
  return ch == " " or ch == "\t"
101
101
 
102
102
  line = lines[0]
@@ -115,6 +115,6 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
115
115
  return __class__.FindPostmasterResult.create_has_problems()
116
116
 
117
117
  pid = int(line[start:pos])
118
- assert type(pid) == int # noqa: E721
118
+ assert type(pid) is int
119
119
 
120
120
  return __class__.FindPostmasterResult.create_ok(pid)
@@ -12,6 +12,6 @@ class InternalPlatformUtils(base.InternalPlatformUtils):
12
12
  data_dir: str
13
13
  ) -> InternalPlatformUtils.FindPostmasterResult:
14
14
  assert isinstance(os_ops, OsOperations)
15
- assert type(bin_dir) == str # noqa: E721
16
- assert type(data_dir) == str # noqa: E721
15
+ assert type(bin_dir) is str
16
+ assert type(data_dir) is str
17
17
  return __class__.FindPostmasterResult.create_not_implemented()
@@ -38,8 +38,8 @@ class PortManager__Generic(PortManager):
38
38
 
39
39
  def reserve_port(self) -> int:
40
40
  assert self._guard is not None
41
- assert type(self._available_ports) == set # noqa: E721t
42
- assert type(self._reserved_ports) == set # noqa: E721
41
+ assert type(self._available_ports) is set
42
+ assert type(self._reserved_ports) is set
43
43
 
44
44
  with self._guard:
45
45
  t = tuple(self._available_ports)
@@ -48,8 +48,8 @@ class PortManager__Generic(PortManager):
48
48
  t = None
49
49
 
50
50
  for port in sampled_ports:
51
- assert type(port) == int # noqa: E721
52
- assert not (port in self._reserved_ports)
51
+ assert type(port) is int
52
+ assert port not in self._reserved_ports
53
53
  assert port in self._available_ports
54
54
 
55
55
  assert port >= __class__._C_MIN_PORT_NUMBER
@@ -61,26 +61,26 @@ class PortManager__Generic(PortManager):
61
61
  self._reserved_ports.add(port)
62
62
  self._available_ports.discard(port)
63
63
  assert port in self._reserved_ports
64
- assert not (port in self._available_ports)
64
+ assert port not in self._available_ports
65
65
  __class__.helper__send_debug_msg("Port {} is reserved.", port)
66
66
  return port
67
67
 
68
68
  raise PortForException("Can't select a port.")
69
69
 
70
70
  def release_port(self, number: int) -> None:
71
- assert type(number) == int # noqa: E721
71
+ assert type(number) is int
72
72
  assert number >= __class__._C_MIN_PORT_NUMBER
73
73
  assert number <= __class__._C_MAX_PORT_NUMBER
74
74
 
75
75
  assert self._guard is not None
76
- assert type(self._reserved_ports) == set # noqa: E721
76
+ assert type(self._reserved_ports) is set
77
77
 
78
78
  with self._guard:
79
79
  assert number in self._reserved_ports
80
- assert not (number in self._available_ports)
80
+ assert number not in self._available_ports
81
81
  self._available_ports.add(number)
82
82
  self._reserved_ports.discard(number)
83
- assert not (number in self._reserved_ports)
83
+ assert number not in self._reserved_ports
84
84
  assert number in self._available_ports
85
85
  __class__.helper__send_debug_msg("Port {} is released.", number)
86
86
  return
@@ -89,8 +89,8 @@ class PortManager__Generic(PortManager):
89
89
  def helper__send_debug_msg(msg_template: str, *args) -> None:
90
90
  assert msg_template is not None
91
91
  assert args is not None
92
- assert type(msg_template) == str # noqa: E721
93
- assert type(args) == tuple # noqa: E721
92
+ assert type(msg_template) is str
93
+ assert type(args) is tuple
94
94
  assert msg_template != ""
95
95
  s = "[port manager] "
96
96
  s += msg_template.format(*args)
@@ -15,19 +15,19 @@ class PortManager__ThisHost(PortManager):
15
15
  assert __class__.sm_single_instance_guard is not None
16
16
 
17
17
  if __class__.sm_single_instance is not None:
18
- assert type(__class__.sm_single_instance) == __class__ # noqa: E721
18
+ assert type(__class__.sm_single_instance) is __class__
19
19
  return __class__.sm_single_instance
20
20
 
21
21
  with __class__.sm_single_instance_guard:
22
22
  if __class__.sm_single_instance is None:
23
23
  __class__.sm_single_instance = __class__()
24
24
  assert __class__.sm_single_instance is not None
25
- assert type(__class__.sm_single_instance) == __class__ # noqa: E721
25
+ assert type(__class__.sm_single_instance) is __class__
26
26
  return __class__.sm_single_instance
27
27
 
28
28
  def reserve_port(self) -> int:
29
29
  return utils.reserve_port()
30
30
 
31
31
  def release_port(self, number: int) -> None:
32
- assert type(number) == int # noqa: E721
32
+ assert type(number) is int
33
33
  return utils.release_port(number)