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

Commit4eb329f

Browse files
committed
fix docstrings
1 parent35fd3a0 commit4eb329f

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

‎.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
-docker
77

88
install:
9-
-sed -e 's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl > Dockerfile
9+
-./mk_dockerfile.sh
1010
-docker-compose build
1111

1212
script:

‎mk_dockerfile.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
set -eu
2+
sed -e's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl> Dockerfile

‎testgres/api.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,28 @@
77
edit configuration files, start/stop cluster, execute queries. The
88
typical flow may look like:
99
10-
with get_new_node() as node:
11-
node.init()
12-
node.start()
13-
result = node.psql('postgres', 'SELECT 1')
14-
print(result)
15-
node.stop()
10+
>>> with get_new_node() as node:
11+
... node.init().start()
12+
... result = node.safe_psql('postgres', 'select 1')
13+
... print(result.decode('utf-8').strip())
14+
... node.stop()
15+
<testgres.node.PostgresNode object at 0x...>
16+
1
17+
<testgres.node.PostgresNode object at 0x...>
1618
1719
Or:
1820
19-
with get_new_node() as node1:
20-
node1.init().start()
21-
with node1.backup() as backup:
22-
with backup.spawn_primary() as node2:
23-
res = node2.start().execute('postgres', 'select 2')
24-
print(res)
21+
>>> with get_new_node() as master:
22+
... master.init().start()
23+
... with master.backup() as backup:
24+
... with backup.spawn_replica() as replica:
25+
... replica = replica.start()
26+
... master.execute('postgres', 'create table test (val int4)')
27+
... master.execute('postgres', 'insert into test values (0), (1), (2)')
28+
... replica.catchup() # wait until changes are visible
29+
... print(replica.execute('postgres', 'select count(*) from test'))
30+
<testgres.node.PostgresNode object at 0x...>
31+
[(3,)]
2532
2633
Copyright (c) 2016, Postgres Professional
2734
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp