public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pytest-env] f45: Update to 1.8.1 upstream release
@ 2026-10-18 9:01 Benjamin A. Beasley
0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-10-18 9:01 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-pytest-env
Branch : f45
Commit : 7c312dce0f42b22b7bcec2b27e3b9426e63664d2
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date : 2026-10-18T09:44:56+01:00
Stats : +190/-3 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/python-pytest-env/c/7c312dce0f42b22b7bcec2b27e3b9426e63664d2?branch=f45
Log:
Update to 1.8.1 upstream release
- Resolves: rhbz#2554727
Upstream tag: 1.8.1
Upstream commit: 1fed4810
Commit co-authored by Packit automation (https://packit.dev/)
---
diff --git a/README.packit b/README.packit
index 41bc266..f1307cd 100644
--- a/README.packit
+++ b/README.packit
@@ -1,3 +1,3 @@
This repository is maintained by packit.
https://packit.dev/
-The file was generated using packit 1.16.3.post1.dev11+g14b012ef4.
+The file was generated using packit 1.16.3.post1.dev27+g2e3440a26.
diff --git a/python-pytest-env.spec b/python-pytest-env.spec
index 6abd162..d89d4b9 100644
--- a/python-pytest-env.spec
+++ b/python-pytest-env.spec
@@ -1,5 +1,5 @@
Name: python-pytest-env
-Version: 1.8.0
+Version: 1.8.1
Release: %autorelease
Summary: Pytest plugin that allows you to add environment variables
@@ -8,6 +8,11 @@ License: MIT
URL: https://github.com/pytest-dev/pytest-env
Source: %{url}/archive/%{version}/pytest-env-%{version}.tar.gz
+# Propagate limited useful env. vars. in `test_native_env_files_override_ini`
+# https://github.com/pytest-dev/pytest-env/pull/275
+# Backported to 1.8.1.
+Patch: test-environment.patch
+
BuildSystem: pyproject
BuildOption(install): --assert-license pytest_env
diff --git a/sources b/sources
index dd03a0f..e07b526 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (pytest-env-1.8.0.tar.gz) = 447864793ca9a90ff287aa76d53fbb6f1883d5450bf0de9746071fe7673108fa828d9c379b2a988e9dbb60c83488f20cb98418f5784634a7c76830955b996ce1
+SHA512 (pytest-env-1.8.1.tar.gz) = 76de632a7448e5bc039b63644689633cffb9588963aa703af854e8c1e56fac72bd2dda4ec667b765e64834b54297fadceb1b5d2faa60797f1906d562a3308ab7
diff --git a/test-environment.patch b/test-environment.patch
new file mode 100644
index 0000000..875b827
--- /dev/null
+++ b/test-environment.patch
@@ -0,0 +1,182 @@
+From d904cdf9d26180f45ccc294f2cfa8cd6542fe195 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= <gaborjbernat@gmail.com>
+Date: Sat, 17 Oct 2026 23:54:17 -0700
+Subject: [PATCH 1/3] style: clean up native env file regression (#274)
+
+---
+ README.md | 7 +++----
+ src/pytest_env/plugin.py | 8 +++++---
+ tests/test_env.py | 22 ++++++++++------------
+ 3 files changed, 18 insertions(+), 19 deletions(-)
+
+diff --git a/README.md b/README.md
+index f12caa9..2947e84 100644
+--- a/README.md
++++ b/README.md
+@@ -201,8 +201,7 @@ env = [
+ ```
+
+ In `pytest.toml` / `.pytest.toml`, this pytest-native `[pytest]` table is an alternative to the plugin-specific
+-`[pytest_env]` TOML table described above. Both forms work there, so `pytest.toml` does not have to use
+-`[pytest_env]`.
++`[pytest_env]` TOML table described above. Both forms work there, so `pytest.toml` does not have to use `[pytest_env]`.
+
+ Prefix flags modify behavior. Flags are case-insensitive and can be combined in any order (e.g., `R:D:KEY=VALUE`):
+
+@@ -243,8 +242,8 @@ MESSAGE="hello\nworld"
+ API_KEY=${FALLBACK_KEY:-default_key}
+ ```
+
+-Missing `.env` files from configuration are silently skipped. Paths are resolved relative to the project root.
+-An explicit `env_files = []` in native TOML configuration disables INI-style `env_files` fallback; omitting the key
++Missing `.env` files from configuration are silently skipped. Paths are resolved relative to the project root. An
++explicit `env_files = []` in native TOML configuration disables INI-style `env_files` fallback; omitting the key
+ preserves that fallback. CLI `--envfile` paths still load in either case.
+
+ ### CLI options
+diff --git a/src/pytest_env/plugin.py b/src/pytest_env/plugin.py
+index f6ef8fb..fcdcaeb 100644
+--- a/src/pytest_env/plugin.py
++++ b/src/pytest_env/plugin.py
+@@ -5,7 +5,7 @@ from __future__ import annotations
+ import os
+ import tomllib
+ from dataclasses import dataclass
+-from typing import TYPE_CHECKING, Any
++from typing import TYPE_CHECKING, Any, Final
+
+ import pytest
+ from dotenv import dotenv_values
+@@ -194,7 +194,7 @@ def _load_toml_config(config_path: Path) -> tuple[list[str] | None, list[Entry],
+ return None, [], None
+
+ raw_env_files = pytest_env_config.get("env_files")
+- env_files = [str(f) for f in raw_env_files] if isinstance(raw_env_files, list) else None
++ env_files: Final[list[str] | None] = [str(f) for f in raw_env_files] if isinstance(raw_env_files, list) else None
+ raw_skip = pytest_env_config.get("env_files_skip_if_set")
+ env_files_skip_if_set = raw_skip if isinstance(raw_skip, bool) else None
+
+@@ -204,7 +204,9 @@ def _load_toml_config(config_path: Path) -> tuple[list[str] | None, list[Entry],
+
+ def _load_env_files(early_config: pytest.Config, env_files: list[str] | None) -> Generator[Path, None, None]:
+ """Resolve and yield existing env files, with CLI option taking precedence."""
+- configured_env_files = env_files if env_files is not None else list(early_config.getini("env_files"))
++ configured_env_files: Final[list[str]] = (
++ env_files if env_files is not None else list(early_config.getini("env_files"))
++ )
+ if cli_envfile := getattr(early_config.known_args_namespace, "envfile", None):
+ if cli_envfile.startswith("+"):
+ if not (resolved := early_config.rootpath / cli_envfile[1:]).is_file():
+diff --git a/tests/test_env.py b/tests/test_env.py
+index 8c541c3..20423b6 100644
+--- a/tests/test_env.py
++++ b/tests/test_env.py
+@@ -787,28 +787,26 @@ def test_native_env_files_override_ini(
+ ) -> None:
+ (pytester.path / "fallback.env").write_text("INHERITED=from_ini\n", encoding="utf-8")
+ (pytester.path / "cli.env").write_text("FROM_CLI=from_cli\n", encoding="utf-8")
+- section = "tool.pytest_env" if config_name == "pyproject.toml" else "pytest_env"
+- native = f"[{section}]\n" + ("env_files = []\n" if empty_env_files else "")
++ native = f"[{'tool.pytest_env' if config_name == 'pyproject.toml' else 'pytest_env'}]\n"
++ if empty_env_files:
++ native += "env_files = []\n"
+ if config_name == "pyproject.toml":
+ pytester.makeini("[pytest]\nenv_files = fallback.env\n")
+ else:
+ native += '\n[pytest]\nenv_files = ["fallback.env"]\n'
+ (pytester.path / config_name).write_text(native, encoding="utf-8")
+- expected_inherited = None if empty_env_files else "from_ini"
+- expected_cli = "from_cli" if extend else None
++ expected_env: Final[tuple[str | None, str | None]] = (
++ None if empty_env_files else "from_ini",
++ "from_cli" if extend else None,
++ )
+ pytester.makepyfile(
+ test_env=dedent(f"""\
+ import os
+
+ def test_env() -> None:
+- assert (os.environ.get("INHERITED"), os.environ.get("FROM_CLI")) == (
+- {expected_inherited!r}, {expected_cli!r}
+- )
++ assert (os.environ.get("INHERITED"), os.environ.get("FROM_CLI")) == {expected_env!r}
+ """),
+ )
+- new_env = {"PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1", "PYTEST_PLUGINS": "pytest_env.plugin"}
+- args = ["--envfile", "+cli.env"] if extend else []
++ new_env: Final[dict[str, str]] = {"PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1", "PYTEST_PLUGINS": "pytest_env.plugin"}
+ with mock.patch.dict(os.environ, new_env, clear=True):
+- result = pytester.runpytest_subprocess(*args)
+- result.assert_outcomes(passed=1)
+- assert result.ret == pytest.ExitCode.OK
++ pytester.runpytest_subprocess(*(["--envfile", "+cli.env"] if extend else [])).assert_outcomes(passed=1)
+--
+2.56.0
+
+
+From 714bb155e85d8a33b74700c49350aee555c584d9 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Sun, 18 Oct 2026 09:17:49 +0100
+Subject: [PATCH 2/3] Propagate PYTHONPATH in
+ test_native_env_files_override_ini
+
+This allows the test to work in environments where `PYTHONPATH` is
+needed to find the `pytest_env` plugin, such as downstream in Fedora.
+---
+ tests/test_env.py | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_env.py b/tests/test_env.py
+index 20423b6..0e8ed59 100644
+--- a/tests/test_env.py
++++ b/tests/test_env.py
+@@ -807,6 +807,13 @@ def test_native_env_files_override_ini(
+ assert (os.environ.get("INHERITED"), os.environ.get("FROM_CLI")) == {expected_env!r}
+ """),
+ )
+- new_env: Final[dict[str, str]] = {"PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1", "PYTEST_PLUGINS": "pytest_env.plugin"}
++ env: dict[str, str] = {}
++ if "PYTHONPATH" in os.environ:
++ env["PYTHONPATH"] = os.environ["PYTHONPATH"]
++ new_env: Final[dict[str, str]] = {
++ **env,
++ "PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1",
++ "PYTEST_PLUGINS": "pytest_env.plugin",
++ }
+ with mock.patch.dict(os.environ, new_env, clear=True):
+ pytester.runpytest_subprocess(*(["--envfile", "+cli.env"] if extend else [])).assert_outcomes(passed=1)
+--
+2.56.0
+
+
+From c2a2247d982bf36d8c0b6ad79467ce05c7e06d84 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Sun, 18 Oct 2026 09:35:21 +0100
+Subject: [PATCH 3/3] Propagate PYTHONDONTWRITEBYTECODE in
+ test_native_env_files_override_ini
+
+This is useful for downstream testing where it may be desirable not to
+leave `.pyc` files lying around.
+---
+ tests/test_env.py | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/tests/test_env.py b/tests/test_env.py
+index 0e8ed59..af3eb17 100644
+--- a/tests/test_env.py
++++ b/tests/test_env.py
+@@ -807,9 +807,8 @@ def test_native_env_files_override_ini(
+ assert (os.environ.get("INHERITED"), os.environ.get("FROM_CLI")) == {expected_env!r}
+ """),
+ )
+- env: dict[str, str] = {}
+- if "PYTHONPATH" in os.environ:
+- env["PYTHONPATH"] = os.environ["PYTHONPATH"]
++ passthrough: Final[list[str]] = ["PYTHONPATH", "PYTHONDONTWRITEBYTECODE"]
++ env: Final[dict[str, str]] = {var: os.environ[var] for var in passthrough if var in os.environ}
+ new_env: Final[dict[str, str]] = {
+ **env,
+ "PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1",
+--
+2.56.0
+
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-18 9:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 9:01 [rpms/python-pytest-env] f45: Update to 1.8.1 upstream release Benjamin A. Beasley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox