pytest-play support for SQL expressions and assertions
Project description
play sql
pytest-play support for SQL expressions and assertions
More info and examples on:
pytest-play, documentation
cookiecutter-qa, see pytest-play in action with a working example if you want to start hacking
Features
This project defines a new pytest-play command:
- type: sql provider: play_sql database_url: postgresql://$db_user:$db_pwd@$db_host/$db_name query: SELECT id, title FROM invoices variable: invoice_id variable_expression: results.first()[0] assertion: invoice_id == $invoice_id
where:
database_url follows the format described http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls
- variable_expression is a Python expression
results.fetchone() returns an array whose elements matches with the next row’s columns and it could be invoked many times until there will be no more rows (eg: first call (1, 'first',), second call (2, 'second'))
results.first() returns an array whose elements matches with the first row’s colums and it can be invoked exactly one time
results.fetchall() returns an array of tuples whose elements matches with the selected colums (eg: [(1, 'first'), (2, 'second'), (3, 'third')])
pytest-play tweets happens here:
Credits
This package was created with Cookiecutter and the cookiecutter-play-plugin (based on audreyr/cookiecutter-pypackage project template).
CHANGES
0.0.3 (2019-01-25)
Supports new pytest-play >= 2.0 YAML based syntax (json no more supported)
0.0.2 (2018-01-22)
No more depends on play_python (deprecated)
0.0.1 (2018-01-11)
First release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for play_sql-0.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c09c2b366a471678b2b241501780963ec6325bb9040726856073d78aa13615b1 |
|
MD5 | b4eb7b75d208b0ac82a4590a14d1b841 |
|
BLAKE2b-256 | ab10e09f11cd35e289245f875adb7abe7defb3d7cae99c7af6519b7f7530f58e |