From 3989a9bb054d3b94f438c5d8d77e657ab5960ba0 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 8 Jul 2021 12:21:30 -0500 Subject: [PATCH 1/2] Docs: monkeypatch.setenv does not accept bool --- src/_pytest/monkeypatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 708b25aa0..75fcdaf91 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -36,7 +36,7 @@ def monkeypatch() -> Generator["MonkeyPatch", None, None]: monkeypatch.delattr(obj, name, raising=True) monkeypatch.setitem(mapping, name, value) monkeypatch.delitem(obj, name, raising=True) - monkeypatch.setenv(name, value, prepend=False) + monkeypatch.setenv(name, value, prepend=os.pathsep) monkeypatch.delenv(name, raising=True) monkeypatch.syspath_prepend(path) monkeypatch.chdir(path) From 17f1a0af8e500151e7e830b8bac3ed5241f0aab1 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 8 Jul 2021 12:43:10 -0500 Subject: [PATCH 2/2] Fix in more places, use default --- doc/en/builtin.rst | 2 +- doc/en/how-to/monkeypatch.rst | 2 +- src/_pytest/monkeypatch.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index ea2f27a4c..99bc951b5 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -132,7 +132,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a monkeypatch.delattr(obj, name, raising=True) monkeypatch.setitem(mapping, name, value) monkeypatch.delitem(obj, name, raising=True) - monkeypatch.setenv(name, value, prepend=False) + monkeypatch.setenv(name, value, prepend=None) monkeypatch.delenv(name, raising=True) monkeypatch.syspath_prepend(path) monkeypatch.chdir(path) diff --git a/doc/en/how-to/monkeypatch.rst b/doc/en/how-to/monkeypatch.rst index 4f9b5aa99..8c5f676b9 100644 --- a/doc/en/how-to/monkeypatch.rst +++ b/doc/en/how-to/monkeypatch.rst @@ -21,7 +21,7 @@ functionality in tests: monkeypatch.delattr(obj, name, raising=True) monkeypatch.setitem(mapping, name, value) monkeypatch.delitem(obj, name, raising=True) - monkeypatch.setenv(name, value, prepend=False) + monkeypatch.setenv(name, value, prepend=None) monkeypatch.delenv(name, raising=True) monkeypatch.syspath_prepend(path) monkeypatch.chdir(path) diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 75fcdaf91..e39712a90 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -36,7 +36,7 @@ def monkeypatch() -> Generator["MonkeyPatch", None, None]: monkeypatch.delattr(obj, name, raising=True) monkeypatch.setitem(mapping, name, value) monkeypatch.delitem(obj, name, raising=True) - monkeypatch.setenv(name, value, prepend=os.pathsep) + monkeypatch.setenv(name, value, prepend=None) monkeypatch.delenv(name, raising=True) monkeypatch.syspath_prepend(path) monkeypatch.chdir(path)