Skip to main content

pytest-variables

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.

License PyPI Travis Issues Requirements

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

Metadata

Release files for pytest-variables 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-variables 1.0
File Size Uploaded Provenance Actions
pytest-variables-1.0.tar.gz 2.6 kB Without provenance Details for pytest-variables-1.0.tar.gz

Release files / pytest-variables-1.0.tar.gz

Download URL pytest-variables-1.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0236ee12d6bc8d3ce3ead2416aa03ff71f80308600e6d70b2fec0ea34c9c2a7d
BLAKE2b-256 checksum
How to use checksums
a40849d0cf7c2757795db64e6df1b8c3c14e741577c7042bc5fefa3cefc055d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pytest-variables 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page