]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-120590: Fix test_pydoc in the refleak hunting mode (GH-120615) (GH-120670)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 18 Jun 2024 09:44:02 +0000 (11:44 +0200)
committerGitHub <noreply@github.com>
Tue, 18 Jun 2024 09:44:02 +0000 (09:44 +0000)
commit4b53ea822c0c52fa2f0d62728b6573a120f15574
tree576574fbb9ea505a715a8874218a910d79bf9387
parente4f1fed5f6bb788d6d5a86bdbb770d25066636d1
[3.12] gh-120590: Fix test_pydoc in the refleak hunting mode (GH-120615) (GH-120670)

Mocking only works if sys.modules['pydoc'] and pydoc are the same,
but some pydoc functions reload the module and change sys.modules.
Ensure that sys.modules['pydoc'] is always restored after the corresponding
tests.
(cherry picked from commit 2cf47389e26cb591342d07dad98619916d5a1b15)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_pydoc/test_pydoc.py