Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With 8.2.0, attempt to import docs from niece module fails #12276

Open
1 of 4 tasks
jaraco opened this issue Apr 30, 2024 · 1 comment
Open
1 of 4 tasks

With 8.2.0, attempt to import docs from niece module fails #12276

jaraco opened this issue Apr 30, 2024 · 1 comment
Labels
status: help wanted developers would like help from experts on this topic topic: collection related to the collection phase type: regression indicates a problem that was introduced in a release which was working previously

Comments

@jaraco
Copy link
Contributor

jaraco commented Apr 30, 2024

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 to import jaraco.xonsh.docs, even though jaraco.xonsh is a module and docs is a sibling of jaraco.
  • 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.xonsh might not be problematic except:
  • The jaraco.xonsh module 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 jaraco/jaraco.xonsh#1 (comment).

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.docs and 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"?
@The-Compiler
Copy link
Member

What's new in pytest 8.2 that would trigger this behavior?

I somewhat painstakingly bisected this by using your act command and adjusting

diff --git i/pyproject.toml w/pyproject.toml
index ebdbf83..1fbe042 100644
--- i/pyproject.toml
+++ w/pyproject.toml
@@ -30,7 +30,7 @@ Homepage = "https://github.com/jaraco/jaraco.xonsh"
 [project.optional-dependencies]
 testing = [
 	# upstream
-	"pytest >= 6, != 8.1.1",
+	"pytest @ git+https://github.com/pytest-dev/pytest@17fc20af78d0c7b739806c4e461d2c9b8c30ceeb",
 	"pytest-checkdocs >= 2.4",
 	"pytest-cov",
 	"pytest-mypy",

accordingly.

This points me to 9989063, see:

@Zac-HD Zac-HD added status: help wanted developers would like help from experts on this topic topic: collection related to the collection phase type: regression indicates a problem that was introduced in a release which was working previously labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted developers would like help from experts on this topic topic: collection related to the collection phase type: regression indicates a problem that was introduced in a release which was working previously
Projects
None yet
Development

No branches or pull requests

3 participants