15
0
forked from pool/python-nox
Files
python-nox/fix-broken-mock-test.patch
Dirk Mueller 83245573b5 - update to 2025.05.01:
* This is a bugfix release that primarily adds support for uv
    0.7+. A few other small fixes were made.
- update to 2025.02.09:
  * This release improves PEP 723 support, including adding
    dependencies to the noxfile itself ("plugins"). It adds the
    long-awaited "requires" option, allowing sessions to require
    other sessions. And it brings further improvements to the
    `pyproject.toml` support, including helpers for dependency-
    groups and Python version lists.
  * More typing and test improvements
  * Some extra simplifications from Ruff
  * Use dependency-groups
  * Pull out env creation into helper method
  * Pulled out `get_virtualenv` & better typing
  * Fix broken mock on CPython 3.12.8+ in tests

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-nox?expand=0&rev=25
2025-09-21 14:46:53 +00:00

47 lines
1.6 KiB
Diff

From 28bbaa5a17ed1ac39be63b1ecd9bd7e187a7db2e Mon Sep 17 00:00:00 2001
From: Henry Schreiner <HenrySchreinerIII@gmail.com>
Date: Thu, 12 Dec 2024 21:44:02 -0500
Subject: [PATCH] tests: fix broken mock on CPython 3.12.8+ (#903)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---
nox/command.py | 4 +++-
tests/test_command.py | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
Index: nox-2024.04.15/nox/command.py
===================================================================
--- nox-2024.04.15.orig/nox/command.py
+++ nox-2024.04.15/nox/command.py
@@ -36,6 +36,8 @@ if TYPE_CHECKING:
ExternalType = Literal["error", True, False]
+_PLATFORM = sys.platform
+
class CommandFailed(Exception):
"""Raised when an executed command returns a non-success status code."""
@@ -67,7 +69,7 @@ def _clean_env(env: Mapping[str, str | N
clean_env = {k: v for k, v in env.items() if v is not None}
# Ensure systemroot is passed down, otherwise Windows will explode.
- if sys.platform == "win32":
+ if _PLATFORM.startswith("win"):
clean_env.setdefault("SYSTEMROOT", os.environ.get("SYSTEMROOT", ""))
return clean_env
Index: nox-2024.04.15/tests/test_command.py
===================================================================
--- nox-2024.04.15.orig/tests/test_command.py
+++ nox-2024.04.15/tests/test_command.py
@@ -157,7 +157,7 @@ def test_run_env_remove(monkeypatch):
)
-@mock.patch("sys.platform", "win32")
+@mock.patch("nox.command._PLATFORM", "win32")
def test_run_env_systemroot():
systemroot = os.environ.setdefault("SYSTEMROOT", "sigil")