Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea11496

Browse files
testgres.utils.get_pg_version2 is added
This a version of get_pg_version that requires and uses an explicit os_ops object.
1 parentc07f112 commitea11496

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎testgres/utils.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,29 @@ def cache_pg_config_data(cmd):
203203
returncache_pg_config_data("pg_config")
204204

205205

206-
defget_pg_version(bin_dir=None):
206+
defget_pg_version2(os_ops:OsOperations,bin_dir=None):
207207
"""
208208
Return PostgreSQL version provided by postmaster.
209209
"""
210+
assertos_opsisnotNone
211+
assertisinstance(os_ops,OsOperations)
210212

211213
# Get raw version (e.g., postgres (PostgreSQL) 9.5.7)
212-
postgres_path=os.path.join(bin_dir,'postgres')ifbin_direlseget_bin_path('postgres')
214+
postgres_path=os.path.join(bin_dir,'postgres')ifbin_direlseget_bin_path2(os_ops,'postgres')
213215
_params= [postgres_path,'--version']
214-
raw_ver=tconf.os_ops.exec_command(_params,encoding='utf-8')
216+
raw_ver=os_ops.exec_command(_params,encoding='utf-8')
215217

216218
returnparse_pg_version(raw_ver)
217219

218220

221+
defget_pg_version(bin_dir=None):
222+
"""
223+
Return PostgreSQL version provided by postmaster.
224+
"""
225+
226+
returnget_pg_version2(tconf.os_ops,bin_dir)
227+
228+
219229
defparse_pg_version(version_out):
220230
# Generalize removal of system-specific suffixes (anything in parentheses)
221231
raw_ver=re.sub(r'\([^)]*\)','',version_out).strip()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp