Make xdoctest pytest items safe for embedding - #214
Merged
Conversation
Erotemic
force-pushed
the
review/04-module-metadata-hardening
branch
from
July 12, 2026 00:38
c8271cd to
b8836d0
Compare
Erotemic
force-pushed
the
review/05-pytest-embedding
branch
2 times, most recently
from
July 12, 2026 03:44
481f725 to
e2f2e0c
Compare
Erotemic
force-pushed
the
review/04-module-metadata-hardening
branch
2 times, most recently
from
July 13, 2026 01:18
cf330ce to
30238a1
Compare
Erotemic
force-pushed
the
review/05-pytest-embedding
branch
from
July 13, 2026 03:17
e2f2e0c to
c7fc48a
Compare
Erotemic
changed the base branch from
review/04-module-metadata-hardening
to
main
July 13, 2026 03:17
Erotemic
marked this pull request as ready for review
July 13, 2026 03:17
Erotemic
force-pushed
the
review/05-pytest-embedding
branch
2 times, most recently
from
July 13, 2026 03:43
451b25d to
9fa8518
Compare
Tolerate an absent optional namespace fixture without hiding dependency failures, and defer text files only to the active pytest-doctestplus owner that matches them. Co-authored-by: GPT-5.6 High <noreply@openai.com>
Erotemic
force-pushed
the
review/05-pytest-embedding
branch
from
July 13, 2026 14:48
9fa8518 to
68e79bc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
XDoctestItemto be embedded when the optionalxdoctest_namespacefixture is not registered.FixtureLookupError..rstand.txtcollection only when the active pytest-doctestplus collector actually owns the path through pytest's standard doctest globs.main, excluding stale checker-lifecycle and module-metadata implementations inherited by the old stacked branch.Pytest compatibility corrections
pathon modern pytest and falls back to legacyfspathinstead of assuming either API or using a platform-sensitive relative filename.py.pathtype on pytest 6 andpathlib.Pathon pytest 7+, matching the production hook boundary.Skip behavior
Current
mainalready contains the accepted #213 behavior:DocTest.run()reports full skips with the most concrete metadata reason, andXDoctestItem.runtest()retains the empty-run fallback. This PR deliberately leaves that centralized behavior unchanged rather than adding a second skip path.Validation
The complete pytest embedding/coexistence group passes in the available environment; the real pytest-doctestplus case skips when that package is absent.
An explicit legacy pytest ownership probe exercises the
py.path.check(fnmatch=...)branch.The publisher runs the complete embedding group under
python3.8when available.The publisher requires
mypy src/xdoctest,ty check src/xdoctest tests/, fatal flake8 selectors, andgit diff --checkbefore publication.Uses a real
PathLikeargument for legacypy.path.local.join, satisfying both pytest 6 runtime behavior and currenttystubs.