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

coverage support

Open joemarshall opened this issue 1 year ago • 3 comments

I cannot work out if there's any way to use coverage with this?

If not, it would be great if there was a way - we have coverage available in pyodide, so it is basically a case of adding coverage calls, and some way of bringing them back into the containing environment.

joemarshall avatar Nov 22 '23 15:11 joemarshall

Do you mean adding a coverage report for code that runs inside Pyodide? There is an issue about it (https://github.com/pyodide/pyodide/issues/2873), but I think nobody tried to implement it.

some way of bringing them back into the containing environment.

This will be the most tricky part I guess. I would appreciate it if you could do some experiment to see if it is possible.

ryanking13 avatar Nov 23 '23 09:11 ryanking13

@ryanking13 I did this manually in urllib3 ci - it works like: load coverage, run python code, return the coverage data. I don't know if it is worth implementing in pytest-pyodide more generally.

joemarshall avatar Jul 11 '24 15:07 joemarshall

Cool. We can probably support something more general: extracting the file inside the Pyodide filesystem to the host, which can be used for coverage file as well.

ryanking13 avatar Jul 12 '24 07:07 ryanking13