Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 053f2ed

Browse files
committed
Merge branch 'master' into gh-pages
2 parents 384a3c7 + 7a40484 commit 053f2ed

File tree

12 files changed

+705
-145
lines changed

12 files changed

+705
-145
lines changed

docs/source/testgres.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,19 @@ testgres.node
5959
.. automethod:: __init__
6060

6161
.. autoclass:: testgres.node.ProcessProxy
62-
:members:
62+
:members:
63+
64+
testgres.pubsub
65+
---------------
66+
67+
.. automodule:: testgres.pubsub
68+
69+
.. autoclass:: testgres.node.Publication
70+
:members:
71+
72+
.. automethod:: __init__
73+
74+
.. autoclass:: testgres.node.Subscription
75+
:members:
76+
77+
.. automethod:: __init__

hooks/pre-commit

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
#!/bin/bash
22

3+
set -e
4+
35
# capture the changed files that have been staged
46
changed_files=$(git diff --staged --name-only)
57

68
for file in ${changed_files}
79
do
810
if [[ "${file##*.}" == "py" ]]; then
9-
echo "Yapfing ${file}"
10-
yapf ${file} -i
11-
git add ${file}
11+
if command -v yapf > /dev/null; then
12+
echo "Run yapf on ${file}"
13+
yapf ${file} -i
14+
git add ${file}
15+
fi
16+
17+
if command -v flake8 > /dev/null; then
18+
echo "Run flake8 on ${file}"
19+
flake8 ${file}
20+
fi
1221
fi
1322
done
23+

setup.py

100644100755
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@
1616
if sys.version_info < (3, 3):
1717
install_requires.append("ipaddress")
1818

19+
# Get contents of README file
20+
with open('README.md', 'r') as f:
21+
readme = f.read()
22+
1923
setup(
20-
version='1.6.0',
24+
version='1.8.0',
2125
name='testgres',
2226
packages=['testgres'],
2327
description='Testing utility for PostgreSQL and its extensions',
2428
url='https://github.com/postgrespro/testgres',
29+
long_description=readme,
30+
long_description_content_type='text/markdown',
2531
license='PostgreSQL',
2632
author='Ildar Musin',
2733
author_email='zildermann@gmail.com',

testgres/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
from .connection import \
1212
NodeConnection, \
13+
DatabaseError, \
1314
InternalError, \
14-
ProgrammingError
15+
ProgrammingError, \
16+
OperationalError
1517

1618
from .exceptions import *
1719
from .enums import *

testgres/backup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ def spawn_primary(self, name=None, destroy=True):
149149
# New nodes should always remove dir tree
150150
node._should_rm_dirs = True
151151

152-
node.append_conf(PG_CONF_FILE, "\n")
153-
node.append_conf(PG_CONF_FILE, "port = {}".format(node.port))
152+
# Set a new port
153+
node.append_conf(filename=PG_CONF_FILE, line='\n')
154+
node.append_conf(filename=PG_CONF_FILE, port=node.port)
154155

155156
return node
156157

testgres/connection.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,24 @@
1717

1818
from .exceptions import QueryException
1919

20-
# export these exceptions
20+
# export some exceptions
21+
DatabaseError = pglib.DatabaseError
2122
InternalError = pglib.InternalError
2223
ProgrammingError = pglib.ProgrammingError
24+
OperationalError = pglib.OperationalError
2325

2426

2527
class NodeConnection(object):
2628
"""
2729
Transaction wrapper returned by Node
2830
"""
2931

30-
def __init__(self, node, dbname=None, username=None, password=None):
32+
def __init__(self,
33+
node,
34+
dbname=None,
35+
username=None,
36+
password=None,
37+
autocommit=False):
3138

3239
# Set default arguments
3340
dbname = dbname or default_dbname()
@@ -42,6 +49,7 @@ def __init__(self, node, dbname=None, username=None, password=None):
4249
host=node.host,
4350
port=node.port)
4451

52+
self._connection.autocommit = autocommit
4553
self._cursor = self.connection.cursor()
4654

4755
@property

testgres/consts.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
BACKUP_LOG_FILE = "backup.log"
2727

2828
# defaults for node settings
29+
MAX_LOGICAL_REPLICATION_WORKERS = 5
2930
MAX_REPLICATION_SLOTS = 10
30-
MAX_WAL_SENDERS = 10
31+
MAX_WORKER_PROCESSES = 10
3132
WAL_KEEP_SEGMENTS = 20
33+
MAX_WAL_SENDERS = 10
34+
35+
# logical replication settings
36+
LOGICAL_REPL_MAX_CATCHUP_ATTEMPTS = 60

testgres/enums.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,14 @@ def from_process(process):
8585

8686
# default
8787
return ProcessType.Unknown
88+
89+
90+
class DumpFormat(Enum):
91+
"""
92+
Available dump formats
93+
"""
94+
95+
Plain = 'plain'
96+
Custom = 'custom'
97+
Directory = 'directory'
98+
Tar = 'tar'

0 commit comments

Comments
 (0)