pytest-variables
pytest plugin for providing variables to tests/fixtures
Decision gist · record as of 2026-08-14
Yes. It is a stable, actively maintained plugin with low install friction and no security vulnerabilities. The copyleft license is standard for pytest plugins and poses no barrier for most test suites. Install it if your tests need to consume external configuration files or if you want to separate test data from test code.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later; optional format support (YAML, TOML, Human JSON) requires installing extras like pytest-variables[yaml].
- Low friction install with only pytest as a runtime dependency.
- Actively maintained with recent commits; last release was in 2024 and the repository shows ongoing activity.
License · maintenance · safety
copyleft license (copyleft) — Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You must disclose source code modifications and include the license with distributions, but can combine with proprietary code in larger works.
last release 2024-02-01 (925 days) · last repo commit 2026-05-26 · 75 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 660,940 downloads/mo, #5,455 on PyPI
Alternatives
Verify before relying
pip install pytest-variables
# Create variables.json:
# {"foo": "bar"}
# In test file:
def test_example(variables):
assert variables['foo'] == 'bar'- Whether merging behavior for duplicate keys across multiple files is predictable enough for complex test suites.
- Performance characteristics when loading very large variable files.
What it is and what it does
pytest-variables is a pytest plugin that externalizes test configuration by loading variables from files into tests as a dictionary. Instead of hardcoding test data or environment values, you specify one or more JSON, YAML, TOML, or Human JSON files via the --variables command-line flag, and the plugin merges them and injects the result into any test that requests the variables fixture. Multiple files are merged in order, with later values overriding earlier ones for non-dictionary keys.
The plugin is useful for test suites that need to run against different configurations—different browsers, operating systems, API endpoints, or credentials—without modifying test code. It supports optional formats (YAML, TOML, Human JSON) via extras, allowing you to choose the file format that best suits your team's workflow. It has a single runtime dependency (pytest) and is actively maintained with support for current Python versions.
Use it for
- Load browser and OS capabilities for cross-browser Selenium tests from separate JSON files.
- Inject API endpoints, credentials, or feature flags into integration tests via YAML configuration.
- Parameterize test data (hostnames, ports, timeouts) without modifying test code.
- Merge environment-specific variables (dev, staging, prod) from multiple TOML files.
- Share test configuration across a team via version-controlled variable files.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
It is a stable, actively maintained plugin with low install friction and no security vulnerabilities. The copyleft license is standard for pytest plugins and poses no barrier for most test suites. Install it if your tests need to consume external configuration files or if you want to separate test data from test code.
Install
pytest-variables on PyPI
Before you install
Low friction install with only pytest as a runtime dependency. Actively maintained with recent commits; last release was in 2024 and the repository shows ongoing activity.
Requires Python 3.8 or later; optional format support (YAML, TOML, Human JSON) requires installing extras like pytest-variables[yaml].
License in practice
Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You must disclose source code modifications and include the license with distributions, but can combine with proprietary code in larger works.
Quickstart
pip install pytest-variables
# Create variables.json:
# {"foo": "bar"}
# In test file:
def test_example(variables):
assert variables['foo'] == 'bar'
Verify before relying
- Whether merging behavior for duplicate keys across multiple files is predictable enough for complex test suites.
- Performance characteristics when loading very large variable files.
Package facts
| License | copyleft license copyleft |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Actively maintained 925 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 660,940 / month, #5,455 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Natural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_variables-3.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest variables from file”
- pytest-variablesA pytest plugin that loads test variables from JSON, YAML, TOML, or…
- pytest-dotenvA pytest plugin that automatically loads environment variables from…
- pytest-envA pytest plugin that loads environment variables from configuration…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also pytest-selenium · pytest-metadata · pytest-regressions · pytest · pytest-env · pytest-helpers-namespace · pytest-lazy-fixtures · pytest-playwright · pytest-html