pytest-pyodide icon indicating copy to clipboard operation
pytest-pyodide copied to clipboard

Add a test module for run_in_pyodide functions

Open hoodmane opened this issue 1 year ago • 5 comments

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

hoodmane avatar Apr 17 '24 08:04 hoodmane

Not yet. Locally the test passes if I do

pytest tests/test_doctest.py

but if I pass -s it fails...

hoodmane avatar Apr 17 '24 15:04 hoodmane

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.

hoodmane avatar Apr 17 '24 15:04 hoodmane

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.

ryanking13 avatar Apr 28 '24 09:04 ryanking13

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

hoodmane avatar Apr 29 '24 09:04 hoodmane

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.

ryanking13 avatar Apr 30 '24 08:04 ryanking13