https://github.com/zh217/py-pgtest
Making postgresql unit-testing less painful
https://github.com/zh217/py-pgtest
postgresql python unit-testing
Last synced: 6 months ago
JSON representation
Making postgresql unit-testing less painful
- Host: GitHub
- URL: https://github.com/zh217/py-pgtest
- Owner: zh217
- License: mit
- Created: 2018-11-05T06:45:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-24T04:49:38.000Z (almost 7 years ago)
- Last Synced: 2025-03-23T23:52:08.375Z (7 months ago)
- Topics: postgresql, python, unit-testing
- Language: Python
- Size: 29.3 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-pgtest
A primitive script to make running postgresql unit-tests less painful.
Requires postgresql server, pgtap and python (>=3.6) installed.
After installation with
```bash
pip install py-pgtest
```
you can go into a directory and run
```bash
pgtest --pg-uri postgres://user:password@host:port/database
```
and the system will:
* first run `__nuke__.sql` in the current directory using psql,
* then run `__init__.sql` in the current directory to do the db initialization (hint: you can
use `\ir` in your script to achieve some structure),
* finally run all `test_*.sql` files found in the subdirectories.The tests should be written in [pgtap](https://pgtap.org/) style, and the test results
will be displayed using python's unittest style.If the argument `--watch` is given, pgtest will watch changes to any
`.sql` files, and rerun the tests when changes occur.There are other options that you can use, e.g. choosing directories other than
the current one. For details, run `pgtest -h`