Make compatible with pytest-asyncio by geigerzaehler · Pull Request #278 · scientific-python/pytest-doctestplus

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@geigerzaehler

Copy link Copy Markdown

Contributor

pytest-asyncio reads 1 collector.obj during test collection which raises an ImportError for DocTestTextfilePlus. We fix this by aligning that class with pytest’s DoctestTextfile 2 and setting obj to None.

Fixes #256

`pytest-asyncio` reads [1] `collector.obj` during test collection which
raises an `ImportError` for `DocTestTextfilePlus`. We fix this by
aligning that class with pytest’s `DoctestTextfile` [2] and setting
`obj` to `None`.

Fixes scientific-python#256

[1]: https://github.com/pytest-dev/pytest-asyncio/blob/eb63d5ad0ca21041726ada3d5c00211d36418a9b/pytest_asyncio/plugin.py#L640
[2]: https://github.com/pytest-dev/pytest/blob/fc56ae365fcdea800f91683186136a8191e22399/src/_pytest/doctest.py#L421

@pllim pllim requested a review from bsipocz

January 21, 2025 15:43

@pllim pllim added this to the v1.4.0 milestone

Jan 21, 2025

@pllim

Copy link Copy Markdown

Contributor

pllim commented

Jan 21, 2025

Needs a change log: https://github.com/scientific-python/pytest-doctestplus/blob/main/CHANGES.rst

Thanks! LGTM but I'll let Brigitta have a look too.

Copy link Copy Markdown

Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good and works as expected. I love when a long-standing issue is boiled down into a one-liner fix. Thank you @geigerzaehler!

geigerzaehler reacted with rocket emoji

@bsipocz bsipocz merged commit 81fe4fd into scientific-python:main

Jan 21, 2025

@bsipocz

Copy link Copy Markdown

Member

bsipocz commented

Jan 21, 2025

I'll tag a release this week, first see if any more fixes can be added to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bsipocz bsipocz bsipocz approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

v1.4.0

Development

Successfully merging this pull request may close these issues.

ModuleNotFoundError with pytest-asyncio

3 participants

@geigerzaehler @pllim @bsipocz