Skip to main content

pytest-variables

pytest-variables is a plugin for py.test that provides variables to tests/fixtures as a dictionary via a 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.3, 3.4, 3.5, or PyPy

  • py.test 2.6 or newer

Installation

To install pytest-variables:

$ pip install pytest-variables

Additional formats

The following optional formats are supported, but must be explicitly installed as they require additional dependencies:

Human JSON

Human JSON is a configuration file format that caters to humans and helps reduce the errors they make. To install Human JSON support:

$ pip install pytest-variables[hjson]

YAML

YAML is a human friendly data serialization standard for all programming languages. To install YAML support:

$ pip install pytest-variables[yaml]

Specifying variables

Use the –variables command line option one or more times to specify paths to files containing your variables:

$ py.test --variables foo.json --variables bar.json

If multiple files are specified then they will be applied in the order they appear on the command line. When duplicates are encountered, the last to be applied will take priority.

Accessing variables

With 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 files 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.4

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.4
File Size Uploaded Provenance Actions
pytest-variables-1.4.tar.gz 3.5 kB Without provenance Details for pytest-variables-1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-variables 1.4
File Interpreter ABI Platform Actions
pytest_variables-1.4-py2-none-any.whl Python 2 none any Details for pytest_variables-1.4-py2-none-any.whl

Total release size: 9.6 kB

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

Download URL pytest-variables-1.4.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
29dcb084ed5d0c357e925c9a6cb454dbe7ae6192fdea2f9d1929f521b4e532e3
BLAKE2b-256 checksum
How to use checksums
ef442f8207347c0ae3e8216feb4306be4ca575e184fda220d057095db9513b2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pytest_variables-1.4-py2-none-any.whl

Download URL pytest_variables-1.4-py2-none-any.whl
Size 6.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
bd2e152e64c8f670e7969c76219a7842cf8ede795703127981ed71af38cfe08a
BLAKE2b-256 checksum
How to use checksums
eef9a9991621b96082be9a76e92a23d73c95bad8bdbbcd6b41fc4e49d51b36f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pytest-variables 1.4

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