Skip to content

Commit 10f43fb

Browse files
committed
fix get_control_data()
1 parent ee89512 commit 10f43fb

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Diff for: testgres/testgres.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -628,15 +628,15 @@ def get_control_data(self):
628628
else:
629629
_params = ["-D", self.data_dir]
630630

631-
lines = _execute_utility("pg_controldata", _params, self.utils_logname)
631+
data = _execute_utility("pg_controldata", _params, self.utils_logname)
632632

633-
out_data = {}
633+
out_dict = {}
634634

635-
for line in lines:
636-
key, value = line.partition(':')[::2]
637-
out_data[key.strip()] = value.strip()
635+
for line in data.splitlines():
636+
key, _, value = line.partition(':')
637+
out_dict[key.strip()] = value.strip()
638638

639-
return out_data
639+
return out_dict
640640

641641
def start(self, params=[]):
642642
"""

Diff for: tests/test_simple.py

+4
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ def test_control_data(self):
155155
try:
156156
node.init()
157157
data = node.get_control_data()
158+
159+
# check returned dict
158160
self.assertIsNotNone(data)
161+
self.assertTrue(any('pg_control' in s for s in data.keys()))
162+
159163
except ExecUtilException as e:
160164
print(e.message)
161165
got_exception = True

0 commit comments

Comments
 (0)