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

Commit7fc973e

Browse files
committed
Porting testgres to python3
1 parent653a0cf commit7fc973e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

‎setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
#download_url = 'https://github.com/postgrespro/testgres/tarball/0.1.1',
1111
keywords= ['testing','postgresql'],
1212
classifiers= [],
13-
install_requires= ["pg8000"]
13+
install_requires= ["pg8000","six"]
1414
)

‎testgres/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fromtestgresimportPostgresNode,get_new_node,clean_all,stop_all
1+
from.testgresimportPostgresNode,get_new_node,clean_all,stop_all

‎testgres/testgres.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
importtempfile
3030
importshutil
3131
importtime
32+
importsix
3233

3334
# Try to use psycopg2 by default. If psycopg2 isn"t available then use
3435
# pg8000 which is slower but much more portable because uses only
@@ -120,7 +121,7 @@ def close(self):
120121
self.connection.close()
121122

122123

123-
classPostgresNode:
124+
classPostgresNode(object):
124125
def__init__(self,name,port):
125126
self.name=name
126127
self.host='127.0.0.1'
@@ -258,7 +259,7 @@ def pg_ctl(self, command, params):
258259
pg_ctl=self.get_bin_path("pg_ctl")
259260

260261
arguments= [pg_ctl]
261-
forkey,valueinparams.iteritems():
262+
forkey,valueinsix.iteritems(params):
262263
arguments.append(key)
263264
ifvalue:
264265
arguments.append(value)
@@ -363,9 +364,8 @@ def poll_query_until(self, dbname, query):
363364

364365
whileattemps<max_attemps:
365366
ret=self.safe_psql(dbname,query)
366-
367367
# TODO: fix psql so that it returns result without newline
368-
ifret=="t\n":
368+
ifret==six.b("t\n"):
369369
return
370370

371371
time.sleep(1)
@@ -410,10 +410,10 @@ def get_config():
410410
pg_config_cmd=os.environ.get("PG_CONFIG") \
411411
if"PG_CONFIG"inos.environelse"pg_config"
412412

413-
out=subprocess.check_output([pg_config_cmd])
414-
forlineinout.split("\n"):
415-
ifline:
416-
key,value=unicode(line).split("=",1)
413+
out=six.StringIO(subprocess.check_output([pg_config_cmd],universal_newlines=True))
414+
forlineinout:
415+
iflineand"="inline:
416+
key,value=line.split("=",1)
417417
pg_config_data[key.strip()]=value.strip()
418418

419419
# Numeric version format

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp