--- id: pytest-env version: "1.7.0" license: MIT License Copyright (c) 2010-202x The pytest-env developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) license_treatment: permissive maintenance: active --- # pytest-env — pytest plugin that allows you to add environment variables. License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install pytest-env uv add pytest-env poetry add pytest-env ## Description # pytest-env [![PyPI](https://img.shields.io/pypi/v/pytest-env?style=flat-square)](https://pypi.org/project/pytest-env/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/pytest-env.svg)](https://pypi.org/project/pytest-env/) [![check](https://github.com/pytest-dev/pytest-env/actions/workflows/check.yaml/badge.svg)](https://github.com/pytest-dev/pytest-env/actions/workflows/check.yaml) [![Downloads](https://static.pepy.tech/badge/pytest-env/month)](https://pepy.tech/project/pytest-env) A `pytest` plugin that sets environment variables from `pyproject.toml`, `pytest.toml`, `.pytest.toml`, or `pytest.ini` configuration files. It can also load variables from `.env` files. - [Installation](#installation) - [Quick start](#quick-start) - [How-to guides](#how-to-guides) - [Load variables from `.env` files](#load-variables-from-env-files) - [Control variable behavior](#control-variable-behavior) - [Set different environments for test suites](#set-different-environments-for-test-suites) - [Reference](#reference) - [TOML configuration format](#toml-configuration-format) -... ## AI interpretation — verify before relying A pytest plugin that injects environment variables into test runs from configuration files (pyproject.toml, pytest.ini, or .env files), with support for variable expansion and conditional assignment. Verdict: Mature, actively maintained pytest plugin with zero known vulnerabilities and permissive MIT licensing. Low install friction and broad Python version support (3.10–3.15) make it a reliable choice for test environment configuration. Well-suited for projects needing flexible environment variable management across different test contexts. [View on SkillFed](https://skillfed.io/packages/pytest-env) · [View on PyPI](https://pypi.org/project/pytest-env/)