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

Fix import_path for packages #11390

Merged

Conversation

nicoddemus
Copy link
Member

For packages, import_path receives the path to the package's __init__.py file, however module names (as they live in sys.modules) should not include the __init__ part.

For example, app/core/__init__.py should be imported as app.core, not as app.core.__init__.

Fix #11306

@nicoddemus nicoddemus added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Sep 5, 2023
For packages, `import_path` receives the path to the package's `__init__.py` file, however module names (as they live in `sys.modules`) should not include the `__init__` part.

For example, `app/core/__init__.py` should be imported as `app.core`, not as `app.core.__init__`.

Fix pytest-dev#11306
@nicoddemus nicoddemus merged commit 194a782 into pytest-dev:main Sep 5, 2023
24 checks passed
@nicoddemus nicoddemus added backport 7.4.x and removed needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch labels Sep 5, 2023
@nicoddemus nicoddemus deleted the 11306-importlib-package-twice branch September 5, 2023 22:44
@flying-sheep
Copy link
Contributor

Ah, I should have followed up on the bug earlier. Now 7.4.1 is released and I have to wait longer to be unblocked 😢

@RonnyPfannschmidt
Copy link
Member

@nicoddemus I believe it's not going to be a problem to trigger a release quick?

@nicoddemus
Copy link
Member Author

nicoddemus commented Sep 7, 2023

I would rather wait on #11317, as that is another bug fix that we can ship.

@RonnyPfannschmidt
Copy link
Member

#11403 will backport that 🚀

@flying-sheep
Copy link
Contributor

Awesome, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module code is executed twice when collecting doctests
4 participants