From a Python perspective, how can one determine the unit test(s) which covered a function or method, or generally any line of code that was hit by a test in the suite by the test runner? It seems reasonable that this information should be at hand given the coverage tools know the specific code that was hit, but I cannot find any way to get at this information (I am using py.test
as my test runner with the coverage
and pytest-cov
modules).
One approach I have found is to just put a pdb.set_trace
call into the code, but it would be really helpful if I could find a more elegant way that didn't require modifying the code under test.
Aucun commentaire:
Enregistrer un commentaire