On 31.03.2021 16:29, Ethan Furman wrote: > On 3/31/21 6:59 AM, M.-A. Lemburg wrote: > >> It seems that some of the doc tests are missing imports of >> e.g. Flag from enum. > > My understanding of doctest is that the global execution environment is > cumulative. For example. the three previous tests, which all pass, are also > not > reimporting Flag.
Looking at the doctest.py source code, there appear to be plenty of ways managing the globals: https://github.com/python/cpython/blob/master/Lib/doctest.py#L872 The globals for each DocTest is formed by combining `globs` and `extraglobs` (bindings in `extraglobs` override bindings in `globs`). A new copy of the globals dictionary is created for each DocTest. If `globs` is not specified, then it defaults to the module's `__dict__`, if specified, or {} otherwise. If `extraglobs` is not specified, then it defaults to {}. > Also note that the tests pass fine locally, suggesting that this is a CI > problem. [1] Perhaps CI is running the tests in a different way than the local Makefile. E.g. CI could be using the "per DocText glob copy", while the Makefile uses the module namespace. I'm only guessing here... never used doctest. > [1] https://bugs.python.org/issue43681 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Mar 31 2021) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ _______________________________________________ python-committers mailing list -- python-committers@python.org To unsubscribe send an email to python-committers-le...@python.org https://mail.python.org/mailman3/lists/python-committers.python.org/ Message archived at https://mail.python.org/archives/list/python-committers@python.org/message/KXOVSPCZHTFPM77BXCQZ6ZVA27QTCBGM/ Code of Conduct: https://www.python.org/psf/codeofconduct/