Is there any way to run coverage against an executable built with pyinstaller? I tried just running it like a it was a python script and it didnt like the executable file as input (I didnt really expect it to work) and I suspect that the answer is no there is no easy way to run coverage against a built executable …. (this is on windows .exe)
the coverage package I am using is just the normal coverage package that you get with “easy_install coverage” from nedbatchelder.com ( http://nedbatchelder.com/code/coverage/ )
This isn’t a fully formulated answer but what I have found so far.
From my understanding of how pyinstaller works is that a binary is constructed from a small C program that embeds a python interpreter and bootstraps loading a script. The PyInstaller constructed EXE includes an archive after the end of the actual binary that contains the resources for the python code. This is explained here http://www.pyinstaller.org/export/develop/project/doc/Manual.html#pyinstaller-archives.
There is iu.py from Pyinstaller/loader/iu.py Docs. You should be able to create an import hook to import from the binary. Googling for pyinstaller disassembler found https://bitbucket.org/Trundle/exetractor/src/00df9ce00e1a/exetractor/pyinstaller.py that looks like it might extract necessary parts.
The other part of this is that all of the resources in the binary archive will be compiled python code. Most likely, coverage.py will give you unhelpful output the same way as when hitting any other compiled module when running under normal conditions.