https://github.com/python/cpython/commit/a08be89212ecd739c7582bdd5861e2ea3809ac3f
commit: a08be89212ecd739c7582bdd5861e2ea3809ac3f
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-02-19T17:49:08Z
summary:

[3.12] gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342) 
(GH-115671)

(cherry picked from commit 872cc9957a9c8b971448e7377fad865f351da6c9)

Co-authored-by: Serhiy Storchaka <[email protected]>

files:
M Lib/doctest.py

diff --git a/Lib/doctest.py b/Lib/doctest.py
index cda2f5a06b270e..696bb966549255 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -2203,13 +2203,13 @@ def __init__(self, test, optionflags=0, setUp=None, 
tearDown=None,
         unittest.TestCase.__init__(self)
         self._dt_optionflags = optionflags
         self._dt_checker = checker
-        self._dt_globs = test.globs.copy()
         self._dt_test = test
         self._dt_setUp = setUp
         self._dt_tearDown = tearDown
 
     def setUp(self):
         test = self._dt_test
+        self._dt_globs = test.globs.copy()
 
         if self._dt_setUp is not None:
             self._dt_setUp(test)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to