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

support IPython DummyMod as __main__ module for pytest fixtures #12965

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

smacke
Copy link

@smacke smacke commented Nov 15, 2024

This PR fixes a corner case when using ipytest with certain IPython environments. Some environments, such as Databricks, use an IPython feature where the user_ns of the interactive shell is specified ahead of time. Because this user_ns doubles as the main module's __dict__, the official module type cannot be used, since __dict__ is a read-only attribute. To work around this, IPython uses a fake module type called DummyMod to handle this case. However, instances of DummyMod do not pass the isinstance check added in c6a5290. To fix, check if we've imported the module that contains DummyMod, and if so, add DummyMod to the isinstance check.

Test plan: verified manually.

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.

1 participant