mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-36406: Handle namespace packages in doctest (GH-12520)
This commit is contained in:
parent
025a602af7
commit
8289e27393
3 changed files with 8 additions and 2 deletions
|
|
@ -1059,7 +1059,8 @@ class DocTestFinder:
|
|||
if module is None:
|
||||
filename = None
|
||||
else:
|
||||
filename = getattr(module, '__file__', module.__name__)
|
||||
# __file__ can be None for namespace packages.
|
||||
filename = getattr(module, '__file__', None) or module.__name__
|
||||
if filename[-4:] == ".pyc":
|
||||
filename = filename[:-1]
|
||||
return self._parser.get_doctest(docstring, globs, name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue