pytest-dev / pytest-dev/pytest
With 8.2.0, attempt to import docs from niece module fails
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
This issue is perhaps one of the weirdest and most obscure I've seen. My investigation began in jaraco/jaraco.xonsh#1. The summary is this:
- In GitHub actions (only), during collection, when attempting to collect
docs/conf.py, something outside the call stack attempts toimport jaraco.xonsh.docs, even thoughjaraco.xonshis a module anddocsis a sibling ofjaraco. - The issue is present in multiple Python versions (at least 3.10-3.12).
- The issue does not replicate when testing locally (either in a Linux Docker container or in macOS).
- The issue does replicate when using act to simulate the GitHub actions using Docker.
- Pinning to pytest<8.2 suppresses the failure.
- Disabling the xonsh plugin suppresses the failure.
- Note that jaraco.xonsh is a xonsh module in a PEP 420 namespace.
- Importing
jaraco.xonshmight not be problematic except:- xonsh itself has a pytest plugin that configures subprocesses to raise on error
- The
jaraco.xonshmodule hasn't been collected or tested (in earlier runs or with pytest 8.2 when it passes locally).
As you might imagine, creating a minimal example is near impossible given the peculiarities of this scenario. The jaraco.xonsh project is nearly a minimal example in itself. The easiest way to replicate the issue is to clone the project at 249226010f9c9e5490dab851947efba2dceecb63, install act, and run the command in https://github.com/jaraco/jaraco.xonsh/issues/1#issuecomment-2084576106.
Questions for which I'm hoping to find answers:
- What is it about GHA that the issue only occurs there?
- What is it that's trying to import
jaraco.xonsh.docsand why doesn't it show up in the stack trace? - What's new in pytest 8.2 that would trigger this behavior?
- How is it that collecting "docs/conf.py" would ever try to import "jaraco.xonsh.docs"?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by cloning jaraco.xonsh at commit 249226010f9c9e5490dab851947efba2dceecb63 and running the command in the linked issue comment with act. Compare pytest 8.2 with pytest<8.2 while collecting docs/conf.py and the xonsh plugin is enabled. Done means explaining the unexpected jaraco.xonsh.docs import and identifying a fix for the collection failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100