On 12/28/13 11:21 PM, Joseph L. Casale wrote:
I have a script that accepts cmdline arguments and receives input via stdin.
I have a unit test for it that uses Popen to setup an environment, pass the args
and provide the stdin.
Problem is obviously this does nothing for providing coverage. Given the above
specifics, anyone know of a way to work around this?
Thanks,
jlc
It sounds like you may have already found the coverage.py docs on
measuring subprocesses. Another approach is to refactor your code so
that the bulk of it can be invoked without a subprocess, then test that
code with simple function calls. Those tests will be easy to measure
with coverage.py, and by the way, they'll run much faster and be easier
to debug.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list