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

Add some support for loading fake modules #1080

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

mrbean-bremen
Copy link
Member

@mrbean-bremen mrbean-bremen commented Oct 20, 2024

This will not handle all possible cases. Relative imports are not supported, and for absolute imports in dot notation an __init__.py is expected in module paths above the leaf module.

Tasks

  • Unit tests added that reproduce the issue or prove feature is working
  • Fix or feature added
  • Entry to release notes added
  • Pre-commit CI shows no errors
  • Unit tests passing
  • For documentation changes: The Read the Docs preview builds and looks as expected

 - works only if open_code patch mode is not off
 - see pytest-dev#1079
@mrbean-bremen
Copy link
Member Author

@Aran-Fey: I only added two tests (one of them basically your example test), please check if you need more cases covered.

@Aran-Fey
Copy link

I'm surprised that relative imports don't work, but that's not a problem for me. This will help a lot, thanks!

@mrbean-bremen mrbean-bremen merged commit de8e415 into pytest-dev:main Oct 20, 2024
67 checks passed
@mrbean-bremen mrbean-bremen deleted the fake_import branch October 20, 2024 13:02
@mrbean-bremen
Copy link
Member Author

I'm surprised that relative imports don't work

You are right, this is easy to fix. Will do this.

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.

2 participants