From 829cc5a24202c1688bfbc747a61afff86ffb24bc Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 24 Jul 2019 14:27:05 +0100 Subject: [PATCH 1/2] fix docs about syspath_prepend eg it does not modify $PATH --- doc/en/monkeypatch.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/en/monkeypatch.rst b/doc/en/monkeypatch.rst index 8e4622982..68ec0a023 100644 --- a/doc/en/monkeypatch.rst +++ b/doc/en/monkeypatch.rst @@ -46,10 +46,13 @@ environment variable is missing, or to set multiple values to a known variable. :py:meth:`monkeypatch.setenv` and :py:meth:`monkeypatch.delenv` can be used for these patches. -4. Use :py:meth:`monkeypatch.syspath_prepend` to modify the system ``$PATH`` safely, and +4. Use `monkeypatch.setenv("PATH", value, prepend=True)` to modify ``$PATH``, and :py:meth:`monkeypatch.chdir` to change the context of the current working directory during a test. +5. Use py:meth:`monkeypatch.syspath_prepend` to modify ``sys.path`` which will also +call :py:meth:`pkg_resources.fixup_namespace_packages` and :py:meth:`importlib.invalidate_caches`. + See the `monkeypatch blog post`_ for some introduction material and a discussion of its motivation. From ebfe8eabf5db5f06cb0302b52ed8213e2f2092a4 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 24 Jul 2019 14:27:51 +0100 Subject: [PATCH 2/2] Update doc/en/monkeypatch.rst --- doc/en/monkeypatch.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/monkeypatch.rst b/doc/en/monkeypatch.rst index 68ec0a023..6cd7da746 100644 --- a/doc/en/monkeypatch.rst +++ b/doc/en/monkeypatch.rst @@ -46,7 +46,7 @@ environment variable is missing, or to set multiple values to a known variable. :py:meth:`monkeypatch.setenv` and :py:meth:`monkeypatch.delenv` can be used for these patches. -4. Use `monkeypatch.setenv("PATH", value, prepend=True)` to modify ``$PATH``, and +4. Use ``monkeypatch.setenv("PATH", value, prepend=True)`` to modify ``$PATH``, and :py:meth:`monkeypatch.chdir` to change the context of the current working directory during a test.