pyodide / pytest-pyodide

Pytest plugin for testing applications that use Pyodide
Mozilla Public License 2.0
24 stars 14 forks source link

Tests always pass no matter what. #81

Open ntoll opened 1 year ago

ntoll commented 1 year ago

Hi,

Thank you for pytest-pyodide.

Context: I'm trying to run some "normal" tests inside Pyodide with PyTest and Chrome.

Problem: no matter what I put into the test functions (e.g. assert False), they always pass.

Example: I've created a repository with a bare minimum reproduction of the problem: https://github.com/ntoll/borked Just follow the instructions in the README and make test.

When I run the tests without --run-in-pyodide they fail as expected. Help?!?! cc/ @hoodmane

ntoll commented 1 year ago

I've spent some more time digging into this problem and focussed on this function.

As far as I can tell there are several problems:

Not sure what to suggest - but something is definitely amiss: only the test module is copied over, and it's not referenced properly when calling pytest.main is the TL;DR.

hoodmane commented 1 year ago

I guess the solution for now is to make a wheel.

ntoll commented 1 year ago

:rofl: yeah :wheel_of_dharma: :+1:

All part of the fun.

ntoll commented 1 year ago

Make a wheel (and then document / script the process)

hoodmane commented 1 year ago

It would be great to fix pytest-pyodide so that it is not required to build a wheel for pure Python libs though.