This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: doctest doesn't support packages
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, eric.snow, ncoghlan, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2016-03-25 12:00 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
doctest_package.patch vstinner, 2016-03-25 12:00 review
Messages (3)
msg262429 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-25 12:00
The PEP 420 -- Implicit Namespace Packages introduces packages which have no __init__.py file and can be made of multiple packages. It looks like doctest doesn't support them.

I would like to convert the Lib/test/ of the Python standard library into such package for the issue #26295.

I propose to use an heuristic when the package is only made of one directory (when module.__path__ only contains one entry): use this directory to lookup for requested test files.

Attached patch implements that.
msg262637 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-29 23:30
New changeset 32539353eb95 by Victor Stinner in branch 'default':
doctest now supports packages
https://hg.python.org/cpython/rev/32539353eb95
msg262638 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-29 23:31
I pushed a different fix using module.__path__ since my use case is the test module splitted into at least two directories.
History
Date User Action Args
2022-04-11 14:58:29adminsetgithub: 70828
2016-03-29 23:31:02vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg262638
2016-03-29 23:30:19python-devsetnosy: + python-dev
messages: + msg262637
2016-03-25 12:00:46vstinnersetcomponents: + Library (Lib)
2016-03-25 12:00:35vstinnercreate