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

Commit 43a5b3c

Browse files
committed
Initial documentation for Github Pages
1 parent 5f11a54 commit 43a5b3c

32 files changed

+17144
-0
lines changed

_sources/index.rst.txt

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
Testgres documentation
3+
======================
4+
5+
Testgres is a PostgreSQL testing framework.
6+
7+
Installation
8+
============
9+
10+
To install testgres, run:
11+
12+
.. code-block:: bash
13+
14+
pip install testgres
15+
16+
We encourage you to use ``virtualenv`` for your testing environment.
17+
18+
Usage
19+
=====
20+
21+
Environment
22+
-----------
23+
24+
Note: by default testgres runs ``initdb``, ``pg_ctl``, ``psql`` provided by ``PATH``.
25+
26+
There are several ways to specify a custom postgres installation:
27+
28+
- export ``PG_CONFIG`` environment variable pointing to the ``pg_config`` executable;
29+
- export ``PG_BIN`` environment variable pointing to the directory with executable files.
30+
31+
Example:
32+
33+
.. code-block:: bash
34+
35+
export PG_BIN=$HOME/pg_10/bin
36+
python my_tests.py
37+
38+
Examples
39+
--------
40+
41+
Here is an example of what you can do with ``testgres``:
42+
43+
.. code-block:: python
44+
45+
# create a node with random name, port, etc
46+
with testgres.get_new_node() as node:
47+
48+
# run inidb
49+
node.init()
50+
51+
# start PostgreSQL
52+
node.start()
53+
54+
# execute a query in a default DB
55+
print(node.execute('select 1'))
56+
57+
# ... node stops and its files are about to be removed
58+
59+
Backup & replication
60+
--------------------
61+
62+
It's quite easy to create a backup and start a new replica:
63+
64+
.. code-block:: python
65+
66+
with testgres.get_new_node('master') as master:
67+
master.init().start()
68+
69+
# create a backup
70+
with master.backup() as backup:
71+
72+
# create and start a new replica
73+
replica = backup.spawn_replica('replica').start()
74+
75+
# catch up with master node
76+
replica.catchup()
77+
78+
# execute a dummy query
79+
print(replica.execute('postgres', 'select 1'))
80+
81+
Modules
82+
=======
83+
84+
.. toctree::
85+
:maxdepth: 2
86+
87+
testgres
88+
89+
90+
.. Indices and tables
91+
.. ==================
92+
93+
.. * :ref:`genindex`
94+
.. * :ref:`modindex`
95+
.. * :ref:`search`

_sources/testgres.rst.txt

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
testgres package
2+
================
3+
4+
testgres.api
5+
------------
6+
7+
.. automodule:: testgres.api
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
testgres.backup
13+
---------------
14+
15+
.. automodule:: testgres.backup
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:
19+
20+
testgres.cache
21+
--------------
22+
23+
.. automodule:: testgres.cache
24+
:members:
25+
:undoc-members:
26+
:show-inheritance:
27+
28+
testgres.config
29+
---------------
30+
31+
.. automodule:: testgres.config
32+
:members:
33+
:undoc-members:
34+
:show-inheritance:
35+
36+
testgres.connection
37+
-------------------
38+
39+
.. automodule:: testgres.connection
40+
:members:
41+
:undoc-members:
42+
:show-inheritance:
43+
44+
testgres.consts
45+
---------------
46+
47+
.. automodule:: testgres.consts
48+
:members:
49+
:undoc-members:
50+
:show-inheritance:
51+
52+
testgres.decorators
53+
-------------------
54+
55+
.. automodule:: testgres.decorators
56+
:members:
57+
:undoc-members:
58+
:show-inheritance:
59+
60+
testgres.defaults
61+
-----------------
62+
63+
.. automodule:: testgres.defaults
64+
:members:
65+
:undoc-members:
66+
:show-inheritance:
67+
68+
testgres.enums
69+
--------------
70+
71+
.. automodule:: testgres.enums
72+
:members:
73+
:undoc-members:
74+
:show-inheritance:
75+
76+
testgres.exceptions
77+
-------------------
78+
79+
.. automodule:: testgres.exceptions
80+
:members:
81+
:undoc-members:
82+
:show-inheritance:
83+
84+
testgres.logger
85+
---------------
86+
87+
.. automodule:: testgres.logger
88+
:members:
89+
:undoc-members:
90+
:show-inheritance:
91+
92+
testgres.node
93+
-------------
94+
95+
.. automodule:: testgres.node
96+
:members:
97+
:undoc-members:
98+
:show-inheritance:
99+
100+
testgres.utils
101+
--------------
102+
103+
.. automodule:: testgres.utils
104+
:members:
105+
:undoc-members:
106+
:show-inheritance:
107+
108+
109+
Module contents
110+
---------------
111+
112+
.. automodule:: testgres
113+
:members:
114+
:undoc-members:
115+
:show-inheritance:

_static/ajax-loader.gif

673 Bytes
Loading

0 commit comments

Comments
 (0)