coverage breaks existing trace functions

Issue #83 invalid
Ricardo Kirkner created an issue

I have some code that install a trace function, which performs alright under normal conditions (ie the standard python interpreter). However, when I run it through coverage, one of my tests fails due to the trace function not getting called.

I think this has to do with coverage assuming no trace function was set before it and so resetting it to None. I'm not even sure if it is possible to have multiple trace functions at the same time (though I would think it should be).

Is this something that has to be fixed in coverage? or in my code? I couldn't find any pointers in google, so I came here.


Comments (3)

  1. Ned Batchelder repo owner

    Python 2.6 and up have a sys.gettrace() function that I suppose could be used to chain the functions together. I've never tried it, but it's something I could investigate. Of course, trying to measure the coverage inside your trace function itself might be impossible...

  2. Ricardo Kirkner reporter

    I thought so, but I haven't yet had the time to investigate the proper solution myself. I just reported it as a bug as I think should handle that (if it's possible to handle at all).

    If I find anything useful I'll let you know.

  3. Ricardo Kirkner reporter

    I got to debug the issue, and I can say it wasn't but our own test, which was broken (it was comparing filenames as reported by the frame, which were different when the test was run directly with python than when running it through coverage). Sorry about the noise.

  4. Log in to comment