]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 19 Feb 2024 17:54:59 +0000 (18:54 +0100)
committerGitHub <noreply@github.com>
Mon, 19 Feb 2024 17:54:59 +0000 (17:54 +0000)
(cherry picked from commit 872cc9957a9c8b971448e7377fad865f351da6c9)

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

index f4396c8f7ad93fcf5909827b231c6187f2e23d48..03db27799289f1586d09bc63ab0a6e4f25a92988 100644 (file)
@@ -2197,13 +2197,13 @@ class DocTestCase(unittest.TestCase):
         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)