Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

| python coverage report error | no source for code: PATH + '/_remote_module_non_scriptable.py'

When I run coverage run -m pytest tests/ followed by coverage report in the terminal

I get the following error:

No source for code: '/private/var/.../_remote_module_non_scriptable.py'.

It seems like a similar issue has been resolved already, however I do not understand the solution.

Can a friendly soul help me understand what might be the cause of the problem?

like image 869
mckris Avatar asked Aug 08 '26 05:08

mckris


1 Answers

coverage xml -i doesn't work for me.

I found out that the <tmpdir>/_remote_module_non_scriptable.py is generated by pytorch.

Solution: add to pyproject.toml

[tool.coverage.run]
omit = [
    # omit pytorch-generated files in /tmp
    "/tmp/*",
]
like image 50
Daniele Franceschi Avatar answered Aug 09 '26 17:08

Daniele Franceschi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!