]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 19 Feb 2024 17:03:21 +0000 (19:03 +0200)
committerGitHub <noreply@github.com>
Mon, 19 Feb 2024 17:03:21 +0000 (19:03 +0200)
Lib/doctest.py

index 1969777b66778753a66c2c0471bb643075e609fd..6049423b5147a5eb46f7934569c5c910b6dedb25 100644 (file)
@@ -2225,13 +2225,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)