pytest plugin for providing variables to tests/fixtures
Project description
pytest-variables is a plugin for py.test that provides variables to tests/fixtures as a dict via a JSON file specified on the command line.
Requirements
You will need the following prerequisites in order to use pytest-variables:
Python 2.6, 2.7, 3.2, 3.3, 3.4 or PyPy
py.test 2.3 or newer
Installation
To install pytest-variables:
pip install pytest-variables
Then run your tests with:
py.test --variables=variables.json
Accessing variables
Create a JSON variables file such as:
{
"foo": "bar",
"bar": "foo"
}
Specify the variables funcarg to make the variables available to your tests. The contents of the JSON are made available as a dictionary:
def test_foo(self, variables):
assert variables['foo'] == 'bar'
assert variables.get('bar') == 'foo'
assert variables.get('missing') is None
Resources
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
pytest-variables-1.0.tar.gz
(2.6 kB
view details)
File details
Details for the file pytest-variables-1.0.tar.gz
.
File metadata
- Download URL: pytest-variables-1.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0236ee12d6bc8d3ce3ead2416aa03ff71f80308600e6d70b2fec0ea34c9c2a7d |
|
MD5 | 08dfa85963cc15dd315a8ee865cb35a1 |
|
BLAKE2b-256 | a40849d0cf7c2757795db64e6df1b8c3c14e741577c7042bc5fefa3cefc055d6 |