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 a test module for run_in_pyodide functions #133

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

Conversation

hoodmane
Copy link
Member

@hoodmane hoodmane commented Apr 17, 2024

This fixes some reflection tools. If we define a class A in the test,

  1. A.__module__ is no longer "builtins"
  2. sys.modules[A.__module__].__dict__ points back to our current global scope
  3. __file__ now has the correct value

This makes name resolution a bit nicer. If we define a class A in the test,
1. A.__module__ is no longer "builtins"
2. sys.modules[A.__module__] points back to our current global scope
3. __file__ now has the correct value
Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Do you have some idea about the test failure?

pytest_pyodide/_decorator_in_pyodide.py Outdated Show resolved Hide resolved
@hoodmane
Copy link
Member Author

Not yet. Locally the test passes if I do

pytest tests/test_doctest.py

but if I pass -s it fails...

@hoodmane
Copy link
Member Author

But it looks like it's failing for an unrelated reason and the test_doctest_run.py behavior is as expected with two passes and a failure. Hmm.

@ryanking13
Copy link
Member

Seems like there was some change in pytest 8.0.0. When I downgrade pytest version to <8.0.0, the failing test passes.

I suspect some of the modifications we do at private attributes doesn't work anymore.

@hoodmane
Copy link
Member Author

Okay, let's cap Pytest <8 and I'll look into fixing it in a followup.

@ryanking13
Copy link
Member

Okay, let's cap Pytest <8 and I'll look into fixing it in a followup.

Sounds good to me. Probably we should find a way to not use pytester plugin which is the reason for the complex modifications we do in the setup step.

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