python library to perform assertion on files
Project description
qload : better assertion on files
qload is a library to load or extract content of a file to perform assertion in automatic tests wihtout boilerplate. It support file from filesystem, ftp, s3, ...
Benefits
- oneliner to assert on the content of a file
- useful differential when the test fails
- support for the most common formats (yaml, csv, json, txt, ...)
- support for multiple file systems and protocols (local, ftp, s3, ...)
Gettings started
pip install qload
Usage
import qload
assert 'database_url: postgresql://127.0.0.1:5432/postgres' in qload.text('file.txt')
assert qload.text('file.txt', expression='Hello .*') == 'Hello Fabien'
assert qload.json('file.json') == {}
assert qload.json('s3://mybucket/file1.json') == {}
assert qload.json('file.json', expression='$.id') == ''
assert len(qload.json('file.json', expression='$.id')) == 4
assert qload.yaml('file.yml') == {}
assert qload.yaml('file.yml', expression='$.id') == ''
assert qload.csv('file.csv', expression='$.id') == ''
assert qload.ftp(host='localhost', port=21, login='admin', password='admin').csv(path='dir/file.csv', expression='') == []
assert qload.s3(bucket='bucket', aws_access_key_id='', aws_secret_access_key='', region_name='eu-west-1', endpoint_url='http://localhost:9090').json(path='dir/file.csv') == {}
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
qload-1.0.0.tar.gz
(5.2 kB
view hashes)
Built Distribution
qload-1.0.0-py3-none-any.whl
(6.1 kB
view hashes)