✨ feat(plugin): add .env file loading support by gaborbernat · Pull Request #191 · pytest-dev/pytest-env

The pytest-dotenv plugin is no longer maintained, leaving users without
a supported way to load .env files during test runs. This adds native .env file support directly to pytest-env,
so users can drop the extra dependency and keep their workflow intact. Closes #184.

A new env_files config option accepts a list of .env file paths, resolved relative to the project root. 📂 The
parser handles KEY=VALUE lines, # comments, blank lines, optional single/double quoting, and whitespace around
keys and values. Missing files are silently skipped, following the dotenv convention that allows committing config
referencing .env while the file only exists locally.

.env files are loaded before inline env entries, so inline config always takes precedence. ✨ This means
existing flags like skip_if_set and transform work naturally with values loaded from .env files. The feature
works across all config formats — native TOML (env_files = [".env"]), and INI linelist (env_files = .env).